summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-2/+2
| | | | Found using: https://github.com/intgr/topy
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - Fixed bug in default compiler plus those of postgresql, mysql, andMike Bayer2013-10-121-20/+0
| | | | | | | | mssql to ensure that any literal SQL expression values are rendered directly as literals, instead of as bound parameters, within a CREATE INDEX statement. [ticket:2742] - don't need expression_as_ddl(); literal_binds and include_table take care of this functionality.
* - A rework to the way that "quoted" identifiers are handled, in thatMike Bayer2013-08-271-1/+0
| | | | | | | | | | | | | | | | instead of relying upon various ``quote=True`` flags being passed around, these flags are converted into rich string objects with quoting information included at the point at which they are passed to common schema constructs like :class:`.Table`, :class:`.Column`, etc. This solves the issue of various methods that don't correctly honor the "quote" flag such as :meth:`.Engine.has_table` and related methods. The :class:`.quoted_name` object is a string subclass that can also be used explicitly if needed; the object will hold onto the quoting preferences passed and will also bypass the "name normalization" performed by dialects that standardize on uppercase symbols, such as Oracle, Firebird and DB2. The upshot is that the "uppercase" backends can now work with force-quoted names, such as lowercase-quoted names and new reserved words. [ticket:2812]
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-1/+3
| | | | | | | | | - rework the event system so that event modules load after their targets, dependencies are reversed - create an improved strategy lookup system for the ORM - rework the ORM to have very few import cycles - move out "importlater" to just util.dependency - other tricks to cross-populate modules in as clear a way as possible
* - A large refactoring of the ``sqlalchemy.sql`` package has reorganizedMike Bayer2013-08-121-351/+42
| | | | | | | | | | | | | | | | | | | | | | the import structure of many core modules. ``sqlalchemy.schema`` and ``sqlalchemy.types`` remain in the top-level package, but are now just lists of names that pull from within ``sqlalchemy.sql``. Their implementations are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``, ``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``, ``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``. Most of the "factory" functions used to create SQL expression objects have been moved to classmethods or constructors, which are exposed in ``sqlalchemy.sql.expression`` using a programmatic system. Care has been taken such that all the original import namespaces remain intact and there should be no impact on any existing applications. The rationale here was to break out these very large modules into smaller ones, provide more manageable lists of function names, to greatly reduce "import cycles" and clarify the up-front importing of names, and to remove the need for redundant functions and documentation throughout the expression package.
* Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from aMike Bayer2013-07-171-1/+3
| | | | | :class:`.Column` object would not be propagated. Also in 0.8.3, 0.7.11. [ticket:2784]
* cleanupMike Bayer2013-06-081-4/+1
|
* - Fixed an obscure bug where the wrong results would beMike Bayer2013-06-071-0/+2
| | | | | | | | | | | fetched when joining/joinedloading across a many-to-many relationship to a single-table-inheriting subclass with a specific discriminator value, due to "secondary" rows that would come back. The "secondary" and right-side tables are now inner joined inside of parenthesis for all ORM joins on many-to-many relationships so that the left->right join can accurately filtered. [ticket:2369]
* dial back the default "flatness" a bit, it will be there for joinedload and ↵Mike Bayer2013-06-061-6/+5
| | | | | | | query.join(), but if you're dealing with aliased() or with_polymorphic() you need to say "flat=True". Just the one flag though, "flat" implies "aliased".
* - improve overlapping selectables, apply to both query and relationshipMike Bayer2013-06-041-5/+18
| | | | | | - clean up inspect() calls within query._join() - make sure join.alias(flat) propagates - fix almost all assertion tests
* OK this is the broken version, need to think a lot more about thisMike Bayer2013-06-031-1/+2
|
* - figured out what the from_self() thing was about, part of query.statement, ↵Mike Bayer2013-06-021-1/+0
| | | | | | but would like to improve upon query.statement needing to do this
* getting things to join without subqueries, but some glitches in the compiler ↵Mike Bayer2013-06-021-0/+1
| | | | | | step when we do query.count() are showing
* implement join rewriting inside of visit_select(). Currently this is global ↵Mike Bayer2013-06-021-2/+5
| | | | or not based on fixing nested_join_translation as True or not.
* sqlite testsMike Bayer2013-05-261-2/+2
|
* - the raw 2to3 runMike Bayer2013-04-271-8/+8
| | | | - went through examples/ and cleaned out excess list() calls
* everything passes with this!!!!!!! holy crap !!!!! and its the simplest of allMike Bayer2013-04-251-1/+1
|
* - Fixed bug in unit of work whereby a joined-inheritanceMike Bayer2013-04-011-1/+3
| | | | | | | | | | | subclass could insert the row for the "sub" table before the parent table, if the two tables had no ForeignKey constraints set up between them. Also in 0.7.11. [ticket:2689] - fix a glitch in the assertsql.CompiledSQL fixture regarding when a multiparam compiledSQL is used within an AllOf - add a new utility function randomize_unitofwork() which does the function of --reversetop
* A meaningful :attr:`.QueryableAttribute.info` attribute isMike Bayer2013-03-091-0/+3
| | | | | | | | added, which proxies down to the ``.info`` attribute on either the :class:`.schema.Column` object if directly present, or the :class:`.MapperProperty` otherwise. The full behavior is documented and ensured by tests to remain stable. [ticket:2675]
* Fixed a bug regarding column annotations which in particularMike Bayer2013-02-021-1/+1
| | | | | | | | 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]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/sql/Diana Clarke2012-11-191-15/+42
|
* - remove remote_foreign annotationMike Bayer2012-10-281-5/+26
| | | | - support annotations on Column where name isn't immediately present
* - fix the fixture here that wasn't creating consistentlyMike Bayer2012-10-011-3/+4
| | | | | | | - rewrite --dropfirst to be more industrial strength, includes views - fix order_by="foreign_key" to maintain the same ordering as metadata.sorted_tables. Not ideal that this was the other way throughout 0.7 but this is still a little-used method, in contrast to metadata.sorted_tables.
* - use our new Cls.memoized_name._reset(self) method in place of all those ↵Mike Bayer2012-09-231-2/+2
| | | | | | __dict__.pop(), remove reset_memoized
* - we're going to attempt to get the type/operator system to eat its own ↵Mike Bayer2012-08-161-0/+2
| | | | | | | | dogfood and use the type-based comparator in all cases. will attempt to remove the _adapt_expression() method entirely as this represents an incomplete and redundant system (though it might be a lot faster)
* - [feature] Added reduce_columns() methodMike Bayer2012-07-281-47/+12
| | | | | | | | | | | | | | | to select() construct, replaces columns inline using the util.reduce_columns utility function to remove equivalent columns. reduce_columns() also adds "with_only_synonyms" to limit the reduction just to those columns which have the same name. The deprecated fold_equivalents() feature is removed [ticket:1729]. - [feature] Added with_labels and reduce_columns keyword arguments to Query.subquery(), to provide two alternate strategies for producing queries with uniquely- named columns. [ticket:1729].
* - a big renaming of all the _Underscore classes to haveMike Bayer2012-07-171-7/+7
| | | | | | plain names. The old names are still defined for backwards compatibility. - _BindParamClause renamed to BindParameter
* - [bug] ORM will perform extra effort to determineMike Bayer2012-07-051-58/+60
| | | | | | | | | that an FK dependency between two tables is not significant during flush if the tables are related via joined inheritance and the FK dependency is not part of the inherit_condition, saves the user a use_alter directive. [ticket:2527]
* absolute imports in core, sqlMike Bayer2012-06-231-3/+3
|
* ignore columns that don't resolve here either.Mike Bayer2012-05-191-1/+10
|
* - merged #1401 branch from bitbucketMike Bayer2012-04-221-36/+128
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - resolved some serious speed hits I missed, we need to ensure only deannotated columns are used in the local/remote collections and soforth so that hash lookups against mapped columns don't dig into __eq__() - fix some other parity mismatches regarding stuff from [ticket:2453], including finding another case where _deep_annotate() was doing the wrong thing, new tests. - [feature] Major rewrite of relationship() internals now allow join conditions which include columns pointing to themselves within composite foreign keys. A new API for very specialized primaryjoin conditions is added, allowing conditions based on SQL functions, CAST, etc. to be handled by placing the annotation functions remote() and foreign() inline within the expression when necessary. Previous recipes using the semi-private _local_remote_pairs approach can be upgraded to this new approach. [ticket:1401]
| * start to work on error messages, allow foreign_keys as only argumentMike Bayer2012-02-251-3/+11
| | | | | | | | if otherwise can't determine join condition due to no fks
| * - figured out again why deannotate must clone()Mike Bayer2012-02-111-2/+2
| | | | | | | | | | - got everything working. just need to update error strings
| * many fixes but still can't get heuristics to work as well as what's existing,Mike Bayer2012-02-111-2/+1
| | | | | | | | tests still failing
| * tweak for correlated subqueries here, seems to work for ↵Mike Bayer2012-02-101-1/+6
| | | | | | | | test_eager_relations:CorrelatedSubqueryTest but need some more testing here
| * - got m2m, local_remote_pairs, etc. workingMike Bayer2012-02-091-6/+70
| | | | | | | | | | | | | | | | - using new traversal that returns the product of both sides of a binary, starting to work with (a+b) == (c+d) types of joins. primaryjoins on functions working - annotations working, including reversing local/remote when doing backref
| * initial annotations approach to join conditions. all tests pass, plus ↵Mike Bayer2012-02-061-17/+31
| | | | | | | | | | | | additional tests in #1401 pass. would now like to reorganize RelationshipProperty more around the annotations concept.
* | - [bug] Fixed bug in expression annotationMike Bayer2012-03-311-9/+21
|/ | | | | | | mechanics which could lead to incorrect rendering of SELECT statements with aliases and joins, particularly when using column_property(). [ticket:2453]
* - Fixed regression from 0.6 whereby ifMike Bayer2012-01-101-7/+1
| | | | | | | "load_on_pending" relationship() flag were used where a non-"get()" lazy clause needed to be emitted on a pending object, it would fail to load.
* happy new yearMike Bayer2012-01-041-1/+1
|
* - added "adapt_on_names" boolean flag to orm.aliased()Mike Bayer2011-09-191-2/+4
| | | | | | | | construct. Allows an aliased() construct to link the ORM entity to a selectable that contains aggregates or other derived forms of a particular attribute, provided the name is the same as that of the entity mapped column.
* - Improvement to multi-param statement logging,Mike Bayer2011-08-221-0/+22
| | | | | | | | long lists of bound parameter sets will be compressed with an informative indicator of the compression taking place. Exception messages use the same improved formatting. [ticket:2243]
* - rework Annotated to no longer use __cmp__(), supply an __eq__() thatMike Bayer2011-07-241-2/+6
| | | | | works with ColumnElement as well as works with non-__eq__() suppliers, works with sets, on Py3K as well.
* - rewrite cloned_traverse() and replacement_traverse() to use a straightMike Bayer2011-07-241-1/+12
| | | | | | | | | | | | | | | | recursive descent with clone() + _copy_internals(). This is essentially what it was doing anyway with lots of unnecessary steps. Fix Alias() to honor the given clone() function which may have been the reason the traversal hadn't been fixed sooner. Alias._copy_internals() will specifically skip an alias of a Table as a more specific form of what it was doing before. This may need to be further improved such that ClauseAdapter or replacement_traverse() send it some specific hints what not to dig into; **kw has been added to all _copy_internals() to support this. replacement/clone traversal is at least clear now. - apply new no_replacement_traverse annotation to join created by _create_joins(), fixes [ticket:2195] - can replace orm.query "_halt_adapt" with "no_replacement_traverse"
* - The join condition produced by with_parentMike Bayer2011-07-061-2/+4
| | | | | | | | as well as when using a "dynamic" relationship against a parent will generate unique bindparams, rather than incorrectly repeating the same bindparam. [ticket:2207]. Also in 0.6.9.
* - Fixed subtle bug that caused SQL to blowMike Bayer2011-06-271-2/+26
| | | | | | | up if: column_property() against subquery + joinedload + LIMIT + order by the column property() occurred. [ticket:2188]. Also in 0.6.9
* - Changed the handling in determination of joinMike Bayer2011-05-071-14/+13
| | | | | | | | | | | conditions such that foreign key errors are only considered between the two given tables. That is, t1.join(t2) will report FK errors that involve 't1' or 't2', but anything involving 't3' will be skipped. This affects join(), as well as ORM relationship and inherit condition logic. Will keep the more conservative approach to [ticket:2153] in 0.6.
* corrected a bunch of spelling typosDiana Clarke2011-02-281-1/+1
|