diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-12-08 14:25:42 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-12-08 14:25:42 -0500 |
commit | 927b9859834096dd77182f935ff611351407f0dc (patch) | |
tree | d73e3495677628a8394f47a6db7c396d1aea97f9 /test/dialect/test_postgresql.py | |
parent | 1ee4736beaadeb9053f8886503b64ee04fa4b557 (diff) | |
download | sqlalchemy-927b9859834096dd77182f935ff611351407f0dc.tar.gz |
- multivalued inserts, [ticket:2623]
- update "not supported" messages for empty inserts, mutlivalue inserts
- rework the ValuesBase approach for multiple value sets so that stmt.parameters
does store a list for multiple values; the _has_multiple_parameters flag now indicates
which of the two modes the statement is within. it now raises exceptions if a subsequent
call to values() attempts to call a ValuesBase with one mode in the style of the other
mode; that is, you can't switch a single- or multi- valued ValuesBase to the other mode,
and also if a multiple value is passed simultaneously with a kwargs set.
Added tests for these error conditions
- Calling values() multiple times in multivalue mode now extends the parameter list to
include the new parameter sets.
- add error/test if multiple *args were passed to ValuesBase.values()
- rework the compiler approach for multivalue inserts, back to where
_get_colparams() returns the same list of (column, value) as before, thereby
maintaining the identical number of append() and other calls when multivalue
is not enabled. In the case of multivalue, it makes a last-minute switch to return
a list of lists instead of the single list. As it constructs the additional lists, the inline
defaults and other calculated default parameters of the first parameter
set are copied into the newly generated lists so that these features continue
to function for a multivalue insert. Multivalue inserts now add no additional
function calls to the compilation for regular insert constructs.
- parameter lists for multivalue inserts now includes an integer index for all
parameter sets.
- add detailed documentation for ValuesBase.values(), including careful wording
to describe the difference between multiple values and an executemany() call.
- add a test for multivalue insert + returning - it works !
- remove the very old/never used "postgresql_returning"/"firebird_returning" flags.
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 0ca07ef2a..38a1d51a3 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -112,31 +112,6 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): '(%(name)s) RETURNING length(mytable.name) ' 'AS length_1', dialect=dialect) - @testing.uses_deprecated('.*argument is deprecated. Please use ' - 'statement.returning.*') - def test_old_returning_names(self): - dialect = postgresql.dialect() - table1 = table('mytable', column('myid', Integer), column('name' - , String(128)), column('description', - String(128))) - u = update(table1, values=dict(name='foo'), - postgres_returning=[table1.c.myid, table1.c.name]) - self.assert_compile(u, - 'UPDATE mytable SET name=%(name)s ' - 'RETURNING mytable.myid, mytable.name', - dialect=dialect) - u = update(table1, values=dict(name='foo'), - postgresql_returning=[table1.c.myid, table1.c.name]) - self.assert_compile(u, - 'UPDATE mytable SET name=%(name)s ' - 'RETURNING mytable.myid, mytable.name', - dialect=dialect) - i = insert(table1, values=dict(name='foo'), - postgres_returning=[table1.c.myid, table1.c.name]) - self.assert_compile(i, - 'INSERT INTO mytable (name) VALUES ' - '(%(name)s) RETURNING mytable.myid, ' - 'mytable.name', dialect=dialect) def test_create_partial_index(self): m = MetaData() |