Commit Graph

10240 Commits

Author SHA1 Message Date
Mike Bayer 50d2432a9e - Mysqlconnector as of version 2.0, probably as a side effect of
the  python 3 merge, now does not expect percent signs (e.g.
as used as the modulus operator and others) to be doubled,
even when using the "pyformat" bound parameter format (this
change is not documented by Mysqlconnector).  The dialect now
checks for py2k and for mysqlconnector less than version 2.0
when detecting if the modulus operator should be rendered as
``%%`` or ``%``.
- Unicode SQL is now passed for MySQLconnector version 2.0 and above;
for Py2k and MySQL < 2.0, strings are encoded.  Note that mysqlconnector
as of 2.0.1 appears to have a bug with unicode DDL on py2k, so the tests here
are skipping until we observe it's fixed.
- take out profiling on mysqlconnector, callcounts vary too much with
its current development speed
2014-10-12 20:14:32 -04:00
Mike Bayer 0426d174e4 - the test_except test was doing an unnecessary workaround of some kind,
take that out, restore the better exception logic in exc
2014-10-12 19:37:14 -04:00
Mike Bayer 6d5c03001c - roll back part of pr 140 to get exception wrapping working again 2014-10-12 09:54:44 -04:00
Mike Bayer f7b119705a Merge remote-tracking branch 'origin/pr/140' into pr140 2014-10-11 20:08:27 -04:00
Mike Bayer 216b88894d add more order by here 2014-10-11 19:02:32 -04:00
Mike Bayer 83e4656337 - embedding an existing predicate into a new one only
seems to be used by test_oracle->test_coerce_to_unicode().  The
predicate here should treat as a lambda based on enabled_for_config.
not sure why this test is not failing on jenkins
2014-10-11 18:35:12 -04:00
Mike Bayer cc29c4afff - Fixed long-standing bug in Oracle dialect where bound parameter
names that started with numbers would not be quoted, as Oracle
doesn't like numerics in bound parameter names.
fixes #2138
2014-10-11 18:25:21 -04:00
Mike Bayer 3e810771a8 - change this literal so that the bound name doesn't have a numeric
name, this is sort of a bug for oracle
2014-10-11 17:33:44 -04:00
Mike Bayer 95be42c06f - :meth:.Insert.from_select now includes Python and SQL-expression
defaults if otherwise unspecified; the limitation where non-
server column defaults aren't included in an INSERT FROM
SELECT is now lifted and these expressions are rendered as
constants into the SELECT statement.
2014-10-10 17:15:19 -04:00
Mike Bayer 3a6cdff884 - apply patches to correct for + sign in with_hint() docs,
fixes #3036
2014-10-10 15:31:07 -04:00
Mike Bayer be8d361be2 - add a migration note for ref #3222 2014-10-09 20:54:19 -04:00
Mike Bayer dd6389f171 - The ON clause rendered when using :meth:.Query.join,
:meth:`.Query.outerjoin`, or the standalone :func:`.orm.join` /
:func:`.orm.outerjoin` functions to a single-inheritance subclass will
now include the "single table criteria" in the ON clause even
if the ON clause is otherwise hand-rolled; it is now added to the
criteria using AND, the same way as if joining to a single-table
target using relationship or similar.
fixes #3222
2014-10-09 20:40:35 -04:00
Mike Bayer 81d1e0455a - Fixed bug where a fair number of SQL elements within
the sql package would fail to ``__repr__()`` successfully,
due to a missing ``description`` attribute that would then invoke
a recursion overflow when an internal AttributeError would then
re-invoke ``__repr__()``.
fixes #3195
2014-10-09 17:20:30 -04:00
Mike Bayer c55d10940b - clean up unicode docs and clarify that client_encoding
at the engine level is not the same thing as at the connect args
level.
2014-10-07 14:06:46 -04:00
Mike Bayer 2885f78e4e - adjustment for ref #3200 as we need an immutabledict() here so
that union() can be called, in the case of a dialect that uses
execution options inside of initialize() (e.g. oursql)
2014-10-07 12:43:27 -04:00
Mike Bayer 5a10b6a455 - Fixed "'NoneType' object has no attribute 'concrete'" error
when using :class:`.AbstractConcreteBase` in conjunction with
a subclass that declares ``__abstract__``.
fixes #3185
2014-10-06 18:33:05 -04:00
Mike Bayer 119674dd25 - The execution options passed to an :class:.Engine either via
:paramref:`.create_engine.execution_options` or
:meth:`.Engine.update_execution_options` are not passed to the
special :class:`.Connection` used to initialize the dialect
within the "first connect" event; dialects will usually
perform their own queries in this phase, and none of the
current available  options should be applied here.  In
particular, the "autocommit" option was causing an attempt to
autocommit within this initial connect which would fail with
an AttributeError due to the non-standard state of the
:class:`.Connection`.
fixes #3200
2014-10-06 18:23:42 -04:00
Mike Bayer c4dee4cbb7 - move some things that are features to the features 2014-10-04 19:10:23 -04:00
Mike Bayer b510b99094 - use provide_metadata for new unique constraint / index tests
- add a test for PG reflection of unique index without any unique
constraint
- for PG, don't include 'duplicates_constraint' in the entry
if the index does not actually mirror a constraint
- use a distinct method for unique constraint reflection within table
- catch unique constraint not implemented condition; this may
be within some dialects and also is expected to be supported by
Alembic tests
- migration + changelogs for #3184
- add individual doc notes as well to MySQL, Postgreql
fixes #3184
2014-10-04 19:06:35 -04:00
Mike Bayer f7dee1380c Merge branch 'reflect-unique-constraints' of https://bitbucket.org/jerdfelt/sqlalchemy into pr30 2014-10-04 17:47:53 -04:00
Mike Bayer 49e750a1d7 - changelog, migration for pr github:134 2014-10-04 12:18:20 -04:00
Mike Bayer be2541736d Merge remote-tracking branch 'origin/pr/134' into pr134 2014-10-04 11:51:52 -04:00
ndparker 7e0835409c add simple tests for new name argument for Table.tometadata() 2014-10-04 00:51:01 +02:00
jonathan vanasco 16d9d366bd * adding 'isouter=False' to sqlalchemy.orm.query.Query (https://bitbucket.org/zzzeek/sqlalchemy/issue/3217/make-join-more-standard-or-improve-error)
$ python setup.py develop
$ pip install nose
$ pip install mock
$ ./sqla_nose.py test.orm.test_joins
.....................................................................................................
----------------------------------------------------------------------
Ran 101 tests in 1.222s

OK

$ ./sqla_nose.py test.orm
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S......................................................................................................................................................................................................................................................................................................................S.......................................................................................................................................................................................................................................................................................................................................................S.......S..S.SSS.SS...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S................................S..S........................S...........................................................................................SSS.S.........SSSSSSSS......SSSSSSSSS........SS...SS...............S.............................S..............................................................SS..SS..............................................................................................................S.
----------------------------------------------------------------------
Ran 3103 tests in 82.607s

OK (SKIP=46)
2014-10-03 13:15:52 -04:00
ndparker 690532131d cleanup exception handling - use new exception hierarchy (since python 2.5) 2014-10-02 22:00:31 +02:00
Mike Bayer 4da020dae3 - rework tests for attached databases into individual tests,
test both memory and file-based
- When selecting from a UNION using an attached database file,
the pysqlite driver reports column names in cursor.description
as 'dbname.tablename.colname', instead of 'tablename.colname' as
it normally does for a UNION (note that it's supposed to just be
'colname' for both, but we work around it).  The column translation
logic here has been adjusted to retrieve the rightmost token, rather
than the second token, so it works in both cases.   Workaround
courtesy Tony Roberts.
fixes #3211
2014-09-29 18:09:25 -04:00
Mike Bayer b6496ba3d2 - A revisit to this issue first patched in 0.9.5, apparently
psycopg2's ``.closed`` accessor is not as reliable as we assumed,
so we have added an explicit check for the exception messages
"SSL SYSCALL error: Bad file descriptor" and
"SSL SYSCALL error: EOF detected" when detecting an
is-disconnect scenario.   We will continue to consult psycopg2's
connection.closed as a first check.
fixes #3021
2014-09-29 17:33:53 -04:00
Mike Bayer 9a10b8a7f5 - cyclomatic complexity; break up visit_select, goes from F to D 2014-09-27 18:15:21 -04:00
Mike Bayer 3cc0cf0148 - cyclomatic complexity: _get_colparams() becomes sql.crud._get_crud_params,
CC goes from F to D
2014-09-27 18:15:21 -04:00
Mike Bayer 7473ab42c4 - cyclomatic complexity: _join_condition goes from E to a B 2014-09-27 18:15:21 -04:00
Mike Bayer 7dfd46ec44 - cyclomatic complexity: instrument_class goes from E to an A 2014-09-27 18:15:21 -04:00
Mike Bayer b275ac099f - cyclomatic complexity; break up reflecttable(), goes from E to B 2014-09-27 18:14:59 -04:00
Mike Bayer 573877b4bc - repair autorollback for branches 2014-09-26 21:41:15 -04:00
Mike Bayer b89523f0b7 - Fixed bug where a "branched" connection, that is the kind you get
when you call :meth:`.Connection.connect`, would not share transaction
status with the parent.  The architecture of branching has been tweaked
a bit so that the branched connection defers to the parent for
all transactional status and operations.
fixes #3190
2014-09-26 16:25:26 -04:00
Mike Bayer fbddf193a6 - Fixed bug where a "branched" connection, that is the kind you get
when you call :meth:`.Connection.connect`, would not share invalidation
status with the parent.  The architecture of branching has been tweaked
a bit so that the branched connection defers to the parent for
all invalidation status and operations.
fixes #3215
2014-09-26 14:55:36 -04:00
Mike Bayer b1a956d421 - add explicit warning re: polymorphic_on, cascading is not supported
at this time.  ref #3214
2014-09-26 12:50:18 -04:00
Mike Bayer cb0c1eda24 comments 2014-09-26 10:59:39 -04:00
Mike Bayer 19ec6c3368 - "column already assigned" message has been updated in 7f82c55f 2014-09-25 21:16:13 -04:00
Mike Bayer 7f82c55fa7 - refactor of declarative, break up into indiviudal methods
that are now affixed to _MapperConfig
- declarative now creates column copies ahead of time
so that they are ready to go for a declared_attr
- overhaul of declared_attr; memoization, cascading modifier
- A relationship set up with :class:`.declared_attr` on
a :class:`.AbstractConcreteBase` base class will now be configured
on the abstract base mapping automatically, in addition to being
set up on descendant concrete classes as usual.
fixes #2670
- The :class:`.declared_attr` construct has newly improved
behaviors and features in conjunction with declarative.  The
decorated function will now have access to the final column
copies present on the local mixin when invoked, and will also
be invoked exactly once for each mapped class, the returned result
being memoized.   A new modifier :attr:`.declared_attr.cascading`
is added as well. fixes #3150
- the original plan for #3150 has been scaled back; by copying
mixin columns up front and memoizing, we don't actually need
the "map properties later" thing.
- full docs + migration notes
2014-09-25 21:08:17 -04:00
Mike Bayer 5e7cb037e8 - convert to spaces 2014-09-25 21:07:15 -04:00
Mike Bayer 42837f4bca - clarify documentation on exists() that it is preferred to be in the
WHERE clause.  fixes #3212
2014-09-24 14:49:30 -04:00
ndparker ce52dd9e3b improve exception vs. exit handling 2014-09-23 23:28:11 +02:00
ndparker d5ecd473ae allow Table.tometadata changing the table name 2014-09-23 22:52:14 +02:00
Mike Bayer 360477cc3a - flake8 all of test/ext/declarative 2014-09-23 13:25:22 -04:00
Mike Bayer 5508388f03 - The :mod:sqlalchemy.ext.automap extension will now set
``cascade="all, delete-orphan"`` automatically on a one-to-many
relationship/backref where the foreign key is detected as containing
one or more non-nullable columns.  This argument is present in the
keywords passed to :func:`.automap.generate_relationship` in this
case and can still be overridden.  Additionally, if the
:class:`.ForeignKeyConstraint` specifies ``ondelete="CASCADE"``
for a non-nullable or ``ondelete="SET NULL"`` for a nullable set
of columns, the argument ``passive_deletes=True`` is also added to the
relationship.  Note that not all backends support reflection of
ondelete, but backends that do include Postgresql and MySQL.
fixes #3210
2014-09-22 23:00:45 -04:00
Mike Bayer 1dacbb25f8 pep8/flake8 2014-09-22 22:22:09 -04:00
Mike Bayer f458ef8456 - these tests don't test anything in SQLAlchemy - from our perpsective,
we need to be in transactions (tested elsewhere) and we need to
emit the correct FOR UPDATE strings (tested elsewhere).  There's nothing
in SQLA to be tested as far as validating that for update causes exceptions
or not, and these tests frequently fail as they are timing sensitive.
2014-09-19 12:41:07 -04:00
Mike Bayer b36cdefba2 - Fixed bug that affected generally the same classes of event
as that of 🎫`3199`, when the ``named=True`` parameter
would be used.  Some events would fail to register, and others
would not invoke the event arguments correctly, generally in the
case of when an event was "wrapped" for adaption in some other way.
The "named" mechanics have been rearranged to not interfere with
the argument signature expected by internal wrapper functions.
fixes #3197
2014-09-18 17:49:07 -04:00
Mike Bayer fe5af837dc fix test 2014-09-18 16:28:54 -04:00
Mike Bayer c7ec21b29e - Fixed an unlikely race condition observed in some exotic end-user
setups, where the attempt to check for "duplicate class name" in
declarative would hit upon a not-totally-cleaned-up weak reference
related to some other class being removed; the check here now ensures
the weakref still references an object before calling upon it further.
fixes #3208
2014-09-18 15:42:27 -04:00