Repository URL to install this package:
Version:
4.0.99 ▾
|
ó EYc @ s d Z d d l m Z m Z m Z m Z d d l m Z m Z m Z m Z m Z m Z d d l m Z m Z m Z d d l m Z d d l m Z d e e e e f d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d S( sC Provide :class:`.Insert`, :class:`.Update` and :class:`.Delete`. i ( t Executablet _generativet _from_objectst DialectKWArgs( t ClauseElementt _literal_as_textt Nullt and_t _clonet _column_as_key( t _interpret_as_fromt _interpret_as_selectt HasPrefixesi ( t util( t exct UpdateBasec B s e Z d Z d Z e j j i e d 6 Z e j Z d Z d Z d Z d Z d Z d Z e e e Z e d Z e d d d Z RS( sJ Form the base for ``INSERT``, ``UPDATE``, and ``DELETE`` statements. t update_baset autocommitc s f d } j r | d k r t | t sN | r] t | d t r] t d n g | D] \ } } | ^ qd _ t | t f St | t t f r| rt | d t t t f r j sá t j d n g | D] } | | ^ qè t f S| | t f Sd S( Nc s@ t | t t f r8 t d t j j | D S| Sd S( Nc s s$ | ] \ } } | j | f Vq d S( N( t key( t .0t ct pval( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pys <genexpr>% s ( t isinstancet listt tuplet dictt zipt tableR ( t p( t self( sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pyt process_single" s i sO When preserve_parameter_order is True, values() only accepts a list of 2-tupless8 This construct does not support multiple parameter sets.( t _preserve_parameter_ordert NoneR R R t ValueErrort _parameter_orderingR t Falset _supports_multi_parametersR t InvalidRequestErrort True( R t parametersR R t valueR ( ( R sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pyt _process_colparams! s " #c O s t d d S( sç Set the parameters for the statement. This method raises ``NotImplementedError`` on the base class, and is overridden by :class:`.ValuesBase` to provide the SET/VALUES clause of UPDATE and INSERT. s params() is not supported for INSERT/UPDATE/DELETE statements. To set the values for an INSERT or UPDATE statement, use stmt.values(**parameters).N( t NotImplementedError( R t argt kw( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pyt paramsA s c C s | j p | j j S( sn Return a 'bind' linked to this :class:`.UpdateBase` or a :class:`.Table` associated with it. ( t _bindR t bind( R ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pyR/ N s c C s | | _ d S( N( R. ( R R/ ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pyt _set_bindU s c G s | | _ d S( sÞ Add a :term:`RETURNING` or equivalent clause to this statement. e.g.:: stmt = table.update().\ where(table.c.data == 'value').\ values(status='X').\ returning(table.c.server_flag, table.c.updated_timestamp) for server_flag, updated_timestamp in connection.execute(stmt): print(server_flag, updated_timestamp) The given collection of column expressions should be derived from the table that is the target of the INSERT, UPDATE, or DELETE. While :class:`.Column` objects are typical, the elements can also be expressions:: stmt = table.insert().returning( (table.c.first_name + " " + table.c.last_name). label('fullname')) Upon compilation, a RETURNING clause, or database equivalent, will be rendered within the statement. For INSERT and UPDATE, the values are the newly inserted/updated values. For DELETE, the values are those of the rows which were deleted. Upon execution, the values of the columns to be returned are made available via the result set and can be iterated using :meth:`.ResultProxy.fetchone` and similar. For DBAPIs which do not natively support returning values (i.e. cx_oracle), SQLAlchemy will approximate this behavior at the result level so that a reasonable amount of behavioral neutrality is provided. Note that not all databases/DBAPIs support RETURNING. For those backends with no support, an exception is raised upon compilation and/or execution. For those who do support it, the functionality across backends varies greatly, including restrictions on executemany() and other statements which return multiple rows. Please read the documentation notes for the database in use in order to determine the availability of RETURNING. .. seealso:: :meth:`.ValuesBase.return_defaults` - an alternative method tailored towards efficient fetching of server-side defaults and triggers for single-row INSERTs or UPDATEs. N( t _returning( R t cols( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/dml.pyt returningY s 5t *c C s>