Commit Graph

884 Commits

Author SHA1 Message Date
Mike Bayer fc624dcfa4 - test_types, test_compiler, with sqlite at least 2013-04-28 14:44:21 -04:00
Mike Bayer 4b614b9b35 - the raw 2to3 run
- went through examples/ and cleaned out excess list() calls
2013-04-27 19:53:57 -04:00
Mike Bayer 5884c2e7e5 Fully implemented the IS and IS NOT operators with
regards to the True/False constants.  An expression like
``col.is_(True)`` will now render ``col IS true``
on the target platform, rather than converting the True/
False constant to an integer bound parameter.
This allows the ``is_()`` operator to work on MySQL when
given True/False constants.
[ticket:2682]
2013-04-22 19:12:47 -04:00
Mike Bayer 23c744b54e - Improvements to the operation of the pymysql dialect on
Python 3, including some important decode/bytes steps.
Issues remain with BLOB types due to driver issues.
Courtesy Ben Trofatter.
- start using util.py3k, we will eventually remove the
sa2to3 fixer entirely
2013-04-21 17:09:45 -04:00
Mike Bayer d5af821b5d Merged in bentrofatter/sqlalchemy-2663 (pull request #49)
Fixed PyMySQL problems for Python 2.x and mitigated some issues with Python 3.x
2013-04-21 16:58:55 -04:00
Mike Bayer a5ede47f12 A major fix to the way in which a select() object produces
labeled columns when apply_labels() is used; this mode
produces a SELECT where each column is labeled as in
<tablename>_<columnname>, to remove column name collisions
for a multiple table select.   The fix is that if two labels
collide when combined with the table name, i.e.
"foo.bar_id" and "foo_bar.id", anonymous aliasing will be
applied to one of the dupes.  This allows the ORM to handle
both columns independently; previously, 0.7
would in some cases silently emit a second SELECT for the
column that was "duped", and in 0.8 an ambiguous column error
would be emitted.   The "keys" applied to the .c. collection
of the select() will also be deduped, so that the "column
being replaced" warning will no longer emit for any select()
that specifies use_labels, though the dupe key will be given
an anonymous label which isn't generally user-friendly.
[ticket:2702]
2013-04-11 16:14:23 -04:00
Mike Bayer 6bdd3bb93f - reinstate insert returning back into test_insert.py; defaultdialect
needs to be explicit here since tablestest sticks testing.db onto metadata.bind
2013-04-01 15:41:57 -04:00
Diana Clarke 25c6732019 moving insert returning test back into CRUD test class until I figure out why moving it broke the oracle/postgres builds 2013-03-30 09:30:58 -04:00
Diana Clarke 2fa9dd6bb8 whitespace 2013-03-30 01:39:40 -04:00
Diana Clarke 2ffc925588 move the update tests from CRUDTest into sql/test_update.py (see #2630) 2013-03-30 01:38:17 -04:00
Diana Clarke e6d6cfbf6b fixing tests for --db=mysql: VARCHAR requires a length on dialect mysql 2013-03-30 01:01:59 -04:00
Diana Clarke 192bddc720 starting on the update tests next, pep8 pass first (see #2630) 2013-03-30 00:33:07 -04:00
Diana Clarke 17487a0db7 move the insert tests from CRUDTest into sql/test_insert.py (see #2630) 2013-03-29 19:10:01 -04:00
Diana Clarke 0f203d57cd move the delete tests from CRUDTest into sql/test_delete.py (see #2630) 2013-03-29 17:25:39 -04:00
Mike Bayer b5b751e3de fix syntax error 2013-03-24 13:45:37 -04:00
Mike Bayer 35c5fd3fba Fixed bug whereby a DBAPI that can return "0"
for cursor.lastrowid would not function correctly
in conjunction with :attr:`.ResultProxy.inserted_primary_key`.
2013-03-23 19:00:11 -04:00
Ben Trofatter 2830346207 Removed commented line from test_types.py 2013-03-19 09:29:26 -07:00
Ben Trofatter 68299cbd44 Added workaround for pymysql3 double wrapping ProgrammingErrors to pymysql dialect.
Added workaround for pymysql3 return a bytes object when queried for isolation level.
2013-03-18 17:58:41 -07:00
Mike Bayer 72c4bdf735 merge plus fix the test spelling too 2013-03-18 11:00:47 -07:00
Mike Bayer 6be35e3898 - auto-append for CheckConstraint should skip table if the expression is against
a lower-case-t table
2013-03-09 18:05:21 -05:00
Mike Bayer c8a80e2130 - remove all compat items that are pre-2.5 (hooray)
- other cleanup
- don't need compat.decimal, that approach never panned out. hopefully
outside libs aren't pulling it in, they shouldn't be
2013-03-09 17:26:16 -05:00
Mike Bayer 8ef3ed1032 - this test is ridiculous, executemany() + returning not supported 2013-03-09 14:42:34 -05:00
Mike Bayer a5ec70a961 - the base correlate tests in test_compiler cover the ones that were here
for now
- fix up adaptation tests to still try to exercise the correlation argument
2013-03-09 12:12:01 -05:00
Mike Bayer d5d9a8c24e - since correlation is now always at least semi-automatic, remove the
ability for correlation to have any effect for a SELECT that's stated
in the FROM.
- add a new exhaustive test suite for correlation to test_compiler
2013-03-09 11:46:44 -05:00
Mike Bayer 9793bf7fb2 go back to the original form, then break out this test into individuals
so it can be managed more easily
2013-03-08 19:00:13 -05:00
Luke Cyca f122a307e0 Changed behavior of Select.correlate() to ignore correlations to froms that don't exist in the superquery. 2013-03-07 11:56:11 -08:00
Mike Bayer a98bb5f0cd Merged in nakagami/sqlalchemy/cymysql (pull request #42)
cymysql support
2013-03-07 12:36:35 -05:00
Hajime Nakagami 50cc82b796 mysql+cymysql test_types.py 2013-03-06 00:21:54 +09:00
Mike Bayer 6ddfe3b390 - :meth:.MetaData.create_all and :meth:.MetaData.drop_all will
now accommodate an empty list as an instruction to not create/drop
any items, rather than ignoring the collection. [ticket:2664].
This is a behavioral change and extra notes to the changelog
and migration document have been added.

- create a new test suite for exercising codepaths
in engine/ddl.py
2013-03-02 17:47:58 -05:00
Mike Bayer 45ba7b6e0e - some linter cleanup, though have disabled the newer linter rules which are just
too much for now
2013-03-02 16:37:58 -05:00
Hajime Nakagami ddca4d30a1 not return unicode string in cymysql dialect 2013-03-02 02:13:05 +09:00
Hajime Nakagami 60028c3607 test for cymysql 2013-02-17 15:07:19 +09:00
Mike Bayer 8550a4c386 port numeric tests to dialect suite 2013-02-06 20:20:07 -05:00
Mike Bayer 47858b85ec - add support for pulling in an external requirements file
- start filling in default versions of remaining requirements that are still only in test/
2013-02-06 17:50:11 -05:00
Mike Bayer 2121c1690a - add an "empty_inserts" requirement target plus a suite test
- add suite tests for basic explicit Sequence support, result-row column access (tests that name_normalize is set correctly among many other things)
2013-02-06 15:49:32 -05:00
Mike Bayer af44efe26e Fixed a bug regarding column annotations which in particular
could impact some usages of the new :func:`.orm.remote` and
:func:`.orm.local` annotation functions, where annotations
could be lost when the column were used in a subsequent
expression.
[ticket:2660]
2013-02-02 20:06:31 -05:00
Mike Bayer eea0ca9fb4 cleanup and pep8 2013-02-02 19:57:45 -05:00
Mike Bayer cb19f227f3 The :meth:.ColumnOperators.in_ operator will now coerce
values of ``None`` to :func:`.null`.
[ticket:2496]
2013-02-02 16:17:58 -05:00
Mike Bayer da3d817f36 Added a new argument to :class:.Enum and its base
:class:`.SchemaType` ``inherit_schema``.  When set to ``True``,
the type will set its ``schema`` attribute of that of the
:class:`.Table` to which it is associated.  This also occurs
during a :meth:`.Table.tometadata` operation; the :class:`.SchemaType`
is now copied in all cases when :meth:`.Table.tometadata` happens,
and if ``inherit_schema=True``, the type will take on the new
schema name passed to the method.   The ``schema`` is important
when used with the Postgresql backend, as the type results in
a ``CREATE TYPE`` statement. [ticket:2657]
2013-02-01 20:47:02 -05:00
Mike Bayer e26b28224d Fixed bug where :meth:.Table.tometadata would fail if a
:class:`.Column` had both a foreign key as well as an
alternate ".key" name for the column.   Also in 0.7.10.
[ticket:2643]
2013-01-27 11:23:59 -05:00
Mike Bayer 2cf83604c6 #2629
insert().returning() raises an informative CompileError if attempted
to compile on a dialect that doesn't support RETURNING.
2013-01-25 12:57:59 -05:00
Mike Bayer 7fedf99586 :class:.Index now supports arbitrary SQL expressions and/or
functions, in addition to straight columns.   Common modifiers
include using ``somecolumn.desc()`` for a descending index and
``func.lower(somecolumn)`` for a case-insensitive index, depending on the
capabilities of the target backend.
[ticket:695]
2013-01-16 21:04:32 -05:00
Mike Bayer 8700264340 - preparing for #695, modernize constraint/index tests 2013-01-16 20:10:55 -05:00
Mike Bayer fbd81de0eb Fixed a regression caused by 🎫2410 whereby a
:class:`.CheckConstraint` would apply itself back to the
original table during a :meth:`.Table.tometadata` operation, as
it would parse the SQL expression for a parent table. The
operation now copies the given expression to correspond to the
new table.
[ticket:2633]
2012-12-11 16:31:41 -05:00
Mike Bayer 3859742a91 Fixed bug where using server_onupdate=<FetchedValue|DefaultClause>
without passing the "for_update=True" flag would apply the default
object to the server_default, blowing away whatever was there.
The explicit for_update=True argument shouldn't be needed with this usage
(especially since the documentation shows an example without it being
used) so it is now arranged internally using a copy of the given default
object, if the flag isn't set to what corresponds to that argument.
Also in 0.7.10. [ticket:2631]
2012-12-08 20:28:43 -05:00
Mike Bayer 33bafcb132 Fixed bug whereby using a label_length on dialect that was smaller
than the size of actual column identifiers would fail to render
the columns correctly in a SELECT statement.
[ticket:2610]
2012-12-08 19:25:04 -05:00
Mike Bayer c183aa098b - refactor test_labels into all compiler/defaultdialect tests 2012-12-08 19:10:44 -05:00
Mike Bayer 9608eb8f1a attempt to hide these from 2to3 2012-12-08 17:50:51 -05:00
Mike Bayer 8070cbde71 internally at least refer to multirow as "multivalues", to distinguish between
an INSERT that's used in executemany() as opposed to one which has a VALUES
clause with multiple entries.
2012-12-08 16:17:20 -05:00
Mike Bayer 927b985983 - 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.
2012-12-08 14:25:42 -05:00