summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* SQLite dialect - support relection from affinitypr/65Erich Blume2014-02-031-11/+36
| | | | | | | | | | | | | | | | | | | | | | SQLite allows column types that aren't technically understood in sqlite by using 'data affinity', which is an algorithm for converting column types in to some sort of useful type that can be stored and retrieved from the db. Unfortunatly, this breaks reflection since we (previously) expected a sqlite db to reflect column types that we permit in the `ischema_names` for that dialect. This patch changes the logic for 'unknown' column types during reflection to instead run through SQLite's data affinity algorithm, and assigns appropriate types from that. It also expands the matching for column type to include column types with spaces (strongly discouraged but allowed by sqlite) and also completely empty column types (in which case the NullType is assigned, which sqlite will treat as a Blob - or rather, Blob is treated as NullType). These changes mean that SQLite will never raise an error for an unknown type during reflection - there will always be some 'useful' type returned, which follows the spirit of SQLite (accomodation before sanity!).
* PEP-8 compliance for dialects/sqlite/base.pyErich Blume2014-01-302-143/+129
|
* - Fixed regression whereby the "annotation" system used by the ORM was leakingMike Bayer2014-01-291-9/+9
| | | | | | | into the names used by standard functions in :mod:`sqlalchemy.sql.functions`, such as ``func.coalesce()`` and ``func.max()``. Using these functions in ORM attributes and thus producing annotated versions of them could corrupt the actual function name rendered in the SQL. [ticket:2927]
* - Fixed 0.9 regression where the new sortable support for :class:`.RowProxy`Mike Bayer2014-01-281-3/+18
| | | | | | | | | would lead to ``TypeError`` when compared to non-tuple types as it attempted to apply tuple() to the "other" object unconditionally. The full range of Python comparison operators have now been implemented on :class:`.RowProxy`, using an approach that guarantees a comparison system that is equivalent to that of a tuple, and the "other" object is only coerced if it's an instance of RowProxy. [ticket:2924]
* - repair the fixture/test here to make sure state isn't left over causing ↵Mike Bayer2014-01-271-1/+1
| | | | other tests to fail
* - docsMike Bayer2014-01-261-37/+115
|
* updatesMike Bayer2014-01-261-52/+87
|
* tweak textMike Bayer2014-01-251-2/+16
|
* seealsos in the tutorialMike Bayer2014-01-251-0/+4
|
* caseMike Bayer2014-01-251-47/+139
|
* - start building out very comprehensive docstrings for core functionsMike Bayer2014-01-252-103/+459
|
* lets document join()Mike Bayer2014-01-241-20/+94
|
* - doc updates, include links to create_engine from tutorials, cleanupMike Bayer2014-01-231-11/+20
| | | | and modernize the engines chapter a bit
* - remove this leftover commented pdbMike Bayer2014-01-231-5/+0
|
* - Fixed an 0.9 regression where the automatic aliasing applied byMike Bayer2014-01-232-3/+11
| | | | | | | | | | :class:`.Query` and in other situations where selects or joins were aliased (such as joined table inheritance) could fail if a user-defined :class:`.Column` subclass were used in the expression. In this case, the subclass would fail to propagate ORM-specific "annotations" along needed by the adaptation. The "expression annotations" system has been corrected to account for this case. [ticket:2918]
* Merge pull request #60 from wichert/mutable-doc-importmike bayer2014-01-231-1/+0
|\ | | | | Remove uneeded import from code example
| * Remove uneeded import from code examplepr/60Wichert Akkerman2014-01-201-1/+0
| | | | | | | | | | This had me reread the code twice to see if I missed why the import was present.
* | - Support is improved for supplying a :func:`.join` construct as theMike Bayer2014-01-224-6/+39
| | | | | | | | | | | | | | | | | | | | target of :paramref:`.relationship.secondary` for the purposes of creating very complex :func:`.relationship` join conditions. The change includes adjustments to query joining, joined eager loading to not render a SELECT subquery, changes to lazy loading such that the "secondary" target is properly included in the SELECT, and changes to declarative to better support specification of a join() object with classes as targets.
* | - Added new test coverage for so-called "down adaptions" of SQL types,Mike Bayer2014-01-222-8/+10
| | | | | | | | | | | | | | | | | | | | | | where a more specific type is adapted to a more generic one - this use case is needed by some third party tools such as ``sqlacodegen``. The specific cases that needed repair within this test suite were that of :class:`.mysql.ENUM` being downcast into a :class:`.types.Enum`, and that of SQLite date types being cast into generic date types. The ``adapt()`` method needed to become more specific here to counteract the removal of a "catch all" ``**kwargs`` collection on the base :class:`.TypeEngine` class that was removed in 0.9. [ticket:2917]
* | - update docs for Numeric/Float, in particular warn against using mismatchedMike Bayer2014-01-211-32/+41
| | | | | | | | types (e.g. [ticket:2916])
* | - Fixed the multiple-table "UPDATE..FROM" construct, only usable onMike Bayer2014-01-202-33/+85
| | | | | | | | | | | | | | | | | | | | | | MySQL, to correctly render the SET clause among multiple columns with the same name across tables. This also changes the name used for the bound parameter in the SET clause to "<tablename>_<colname>" for the non-primary table only; as this parameter is typically specified using the :class:`.Column` object directly this should not have an impact on applications. The fix takes effect for both :meth:`.Table.update` as well as :meth:`.Query.update` in the ORM. [ticket:2912]
* | - further refine this so that the ordering of columns is maintained asMike Bayer2014-01-202-16/+18
| | | | | | | | | | sent to the primary key constraint; existing tests in the PG dialect confirm this.
* | - simplify the mechanics of PrimaryKeyConstraint with regards to reflection;Mike Bayer2014-01-202-23/+120
| | | | | | | | | | | | | | | | | | | | | | | | reflection now updates the PKC in place. - support the use case of the empty PrimaryKeyConstraint in order to specify constraint options; the columns marked as primary_key=True will now be gathered into the columns collection, rather than being ignored. [ticket:2910] - add validation such that column specification should only take place in the PrimaryKeyConstraint directly, or by using primary_key=True flags; if both are present, they have to match exactly, otherwise the condition is assumed to be ambiguous, and a warning is emitted; the old behavior of using the PKC columns only is maintained.
* | - repair signature for base get_unique_constraints() methodMike Bayer2014-01-202-1/+2
|/ | | | - test_autoincrement_col still needs reflection overall
* - alter behavior such that dialect_kwargs is still immutable, butMike Bayer2014-01-191-10/+5
| | | | | | now represents exactly the kwargs that were passed, and not the defaults. the defaults are still in dialect_options. This allows repr() schemes such as that of alembic to not need to look through and compare for defaults.
* - some test fixesMike Bayer2014-01-192-28/+27
| | | | - clean up some shenanigans in reflection
* - implement kwarg validation and type system for dialect-specificMike Bayer2014-01-1814-80/+293
| | | | | arguments; [ticket:2866] - add dialect specific kwarg functionality to ForeignKeyConstraint, ForeignKey
* - changelog for pullreq:11Mike Bayer2014-01-181-1/+1
| | | | - be specific about version 0.9.2
* Merge branch 'patch-msql-pkc-clustered' of bitbucket.org:dharland/sqlalchemy ↵Mike Bayer2014-01-182-8/+73
|\ | | | | | | into m
| * Bug Fix: Stop generating bad sql if an empty UniqueConstraint() is givendonkopotamus2014-01-172-0/+4
| |
| * Support mssql_clustered option on UniqueConstraint (plus docs and test)donkopotamus2014-01-171-4/+29
| |
| * Remove support for mssql_clustered on Tabledonkopotamus2014-01-171-15/+5
| |
| * Support mssql_clustered option in mssql dialect for both Table and ↵donkopotamus2014-01-141-8/+54
| | | | | | | | PrimaryKeyConstraint
* | - rework Oracle to no longer do its own unicode conversion; this has been ↵Mike Bayer2014-01-174-17/+67
| | | | | | | | | | | | | | | | | | | | | | observed to be very slow. this now has the effect of producing "conditional" unicode conversion for the Oracle backend, as it still returns NVARCHAR etc. as unicode [ticket:2911] - add new "conditional" functionality to unicode processors; the C-level function now uses PyUnicode_Check() as a fast alternative to the isinstance() check in Python
* | Merge pull request #58 from kstark/patch-1mike bayer2014-01-141-1/+1
|\ \ | | | | | | Fix TypeError for class_mapper called w/ iterable
| * | Fix TypeError for class_mapper called w/ iterablepr/58Kyle Stark2014-01-131-1/+1
| | | | | | | | | When the class_ passed is not a mapped class but is actually an iterable, the string formatting operation fails with a TypeError, and the expected ArgumentError is not raised. Calling code which is using reflection and expects this error will fail (e.g. the sadisplay module).
* | | - _cursor_execute() will close the cursor on error; oracle doesn't allow ↵Mike Bayer2014-01-132-14/+14
| | | | | | | | | | | | | | | | | | double close - ensure no iterator changed size issues in testing.engines
* | | - Fixed a bug involving the new flattened JOIN structures whichMike Bayer2014-01-131-4/+3
| |/ |/| | | | | | | | | | | | | | | | | | | are used with :func:`.joinedload()` (thereby causing a regression in joined eager loading) as well as :func:`.aliased` in conjunction with the ``flat=True`` flag and joined-table inheritance; basically multiple joins across a "parent JOIN sub" entity using different paths to get to a target class wouldn't form the correct ON conditions. An adjustment / simplification made in the mechanics of figuring out the "left side" of the join in the case of an aliased, joined-inh class repairs the issue. [ticket:2908]
* | - The MySQL CAST compilation now takes into account aspects of a stringMike Bayer2014-01-134-31/+81
|/ | | | | | | | | | | | | | | | | | | | | type such as "charset" and "collation". While MySQL wants all character- based CAST calls to use the CHAR type, we now create a real CHAR object at CAST time and copy over all the parameters it has, so that an expression like ``cast(x, mysql.TEXT(charset='utf8'))`` will render ``CAST(t.col AS CHAR CHARACTER SET utf8)``. - Added new "unicode returns" detection to the MySQL dialect and to the default dialect system overall, such that any dialect can add extra "tests" to the on-first-connect "does this DBAPI return unicode directly?" detection. In this case, we are adding a check specifically against the "utf8" encoding with an explicit "utf8_bin" collation type (after checking that this collation is available) to test for some buggy unicode behavior observed with MySQLdb version 1.2.3. While MySQLdb has resolved this issue as of 1.2.4, the check here should guard against regressions. The change also allows the "unicode" checks to log in the engine logs, which was not previously the case. [ticket:2906]
* revert r2775c95b1ee30831216cc5 which was mostly an inadvertent commit, ↵Mike Bayer2014-01-132-42/+21
| | | | except for the changelog part
* - continue with [ticket:2907] and further clean up how we set upMike Bayer2014-01-132-18/+46
| | | | | | | | | | | | | | _reset_agent, so that it's local to the various begin_impl(), rollback_impl(), etc. this allows setting/resetting of the flag to be symmetric. - don't set _reset_agent if it's not None, don't unset it if it isn't our own transaction. - make sure we clean it out in close(). - basically, we're dealing here with pools using "threadlocal" that have a counter, other various mismatches that the tests bring up - test for recover() now has to invalidate() the previous connection, because closing it actually rolls it back (e.g. this test was relying on the broken behavior).
* - :class:`.Connection` now associates a newMike Bayer2014-01-122-20/+51
| | | | | | | | | | | | | | | | | | | | | | :class:`.RootTransaction` or :class:`.TwoPhaseTransaction` with its immediate :class:`._ConnectionFairy` as a "reset handler" for the span of that transaction, which takes over the task of calling commit() or rollback() for the "reset on return" behavior of :class:`.Pool` if the transaction was not otherwise completed. This resolves the issue that a picky transaction like that of MySQL two-phase will be properly closed out when the connection is closed without an explicit rollback or commit (e.g. no longer raises "XAER_RMFAIL" in this case - note this only shows up in logging as the exception is not propagated within pool reset). This issue would arise e.g. when using an orm :class:`.Session` with ``twophase`` set, and then :meth:`.Session.close` is called without an explicit rollback or commit. The change also has the effect that you will now see an explicit "ROLLBACK" in the logs when using a :class:`.Session` object in non-autocommit mode regardless of how that session was discarded. Thanks to Jeff Dairiki and Laurence Rowe for isolating the issue here. [ticket:2907]
* - add new event PoolEvents.invalidate(). allows interception of invalidationMike Bayer2014-01-123-54/+208
| | | | | | | | | | | | | | | events including auto-invalidation, which is useful both for tests here as well as detecting failure conditions within the "reset" or "close" cases. - rename the argument for PoolEvents.reset() to dbapi_connection and connection_record to be consistent with everything else. - add new documentation sections on invalidation, including auto-invalidation and the invalidation process within the pool. - add _ConnectionFairy and _ConnectionRecord to the pool documentation. Establish docs for common _ConnectionFairy/_ConnectionRecord methods and accessors and have PoolEvents docs refer to _ConnectionRecord, since it is passed to all events. Rename a few _ConnectionFairy methods that are actually private to pool such as _checkout(), _checkin() and _checkout_existing(); there should not be any external code calling these
* - bump up how many args for "named arg style" to fourMike Bayer2014-01-121-1/+1
|
* expose SchemaVisitor in the compatibility layerpr/57Sean Dague2014-01-111-0/+4
| | | | | | | | sqlalchemy-migrate uses SchemaVisitor. It was one of the only objects that changed namespaces without compatibility that we use. Would love to get this added to remove a work around we need at https://review.openstack.org/#/c/66156/
* new changelogMike Bayer2014-01-112-21/+42
|
* - fix some function mismatch in profilingMike Bayer2014-01-091-6/+3
|
* 0.9.2Mike Bayer2014-01-091-1/+1
|
* Use PyMODINIT_FUNCpr/55cgohlke2014-01-081-1/+1
|
* Use PyMODINIT_FUNCcgohlke2014-01-081-1/+1
|