summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - Column() supports a keyword argument "sqlite_autoincrement", whichMike Bayer2009-12-181-1/+3
| | | | | | | | applies the SQLite keyword "AUTOINCREMENT" to columns within DDL - will prevent generation of a separate PRIMARY KEY constraint. [ticket:1016] - added docs - fixed underlines in mysql.rst
* - Fixed bug preventing alias() of an alias() from beingMike Bayer2009-12-181-1/+1
| | | | | cloned or adapted (occurs frequently in ORM operations). [ticket:1641]
* documentation patch for [ticket:1354]Mike Bayer2009-12-091-2/+8
|
* - Session.execute() now locates table- andMike Bayer2009-12-081-2/+8
| | | | | | mapper-specific binds based on a passed in expression which is an insert()/update()/delete() construct. [ticket:1054]
* - removed needless "counter" behavior with select()Mike Bayer2009-12-081-8/+0
| | | | | | | | | | labelnames that match a column name in the table, i.e. generates "tablename_id" for "id", instead of "tablename_id_1" in an attempt to avoid naming conflicts, when the table has a column actually named "tablename_id" - this is because the labeling logic is always applied to all columns so a naming conflict will never occur.
* - multi-part schema names, i.e. with dots such asMike Bayer2009-12-081-1/+1
| | | | | | | "dbo.master", are now rendered in select() labels with underscores for dots, i.e. "dbo_master_table_column". This is a "friendly" label that behaves better in result sets. [ticket:1428]
* - The "use get" behavior of many-to-one relations, i.e. that aMike Bayer2009-12-081-8/+3
| | | | | | | | | | | | | | lazy load will fallback to the possibly cached query.get() value, now works across join conditions where the two compared types are not exactly the same class, but share the same "affinity" - i.e. Integer and SmallInteger. Also allows combinations of reflected and non-reflected types to work with 0.5 style type reflection, such as PGText/Text (note 0.6 reflects types as their generic versions). [ticket:1556] - types now support an "affinity comparison" operation, i.e. that an Integer/SmallInteger are "compatible", or a Text/String, PickleType/Binary, etc. Part of [ticket:1556].
* - reworked the DDL generation of ENUM and similar to be more platform agnostic.Mike Bayer2009-12-062-21/+31
| | | | | | | Uses a straight CheckConstraint with a generic expression. Preparing for boolean constraint in [ticket:1589] - CheckConstraint now accepts SQL expressions, though support for quoting of values will be very limited. we don't want to get into formatting dates and such.
* scan for autocommit based on text() specific flag, saves isinstance() call ↵Mike Bayer2009-11-101-2/+2
| | | | on each execution.
* - subclassed Function off of new FunctionElement generic baseMike Bayer2009-11-101-51/+57
| | | | | | - removed "key" accessor of Function, Grouping - this doesn't seem to be used for anything - various formatting - documented the four "Element" classes in the compiler extension as per [ticket:1590]
* - query.get() can be used with a mapping to an outer joinMike Bayer2009-11-091-0/+18
| | | | | where one or more of the primary key values are None. [ticket:1135]
* - The "start" and "increment" attributes on Sequence nowMike Bayer2009-11-031-0/+11
| | | | | | generate "START WITH" and "INCREMENT BY" by default, on Oracle and Postgresql. Firebird doesn't support these keywords right now. [ticket:1545]
* added docs to case() illusrtating usage of `literal_column()`, can't ↵Mike Bayer2009-10-281-1/+11
| | | | implement #809 directly
* - generalized Enum to issue a CHECK constraint + VARCHAR on default platformMike Bayer2009-10-252-9/+26
| | | | - added native_enum=False flag to do the same on MySQL, PG, if desired
* - Added new ENUM type to the Postgresql dialect, which exists as a schema-levelMike Bayer2009-10-252-33/+28
| | | | | | | | | | | | | | | | | | | | | | | | | construct and extends the generic Enum type. Automatically associates itself with tables and their parent metadata to issue the appropriate CREATE TYPE/DROP TYPE commands as needed, supports unicode labels, supports reflection. [ticket:1511] - MySQL ENUM now subclasses the new generic Enum type, and also handles unicode values implicitly, if the given labelnames are unicode objects. - Added a new Enum generic type, currently supported on Postgresql and MySQL. Enum is a schema-aware object to support databases which require specific DDL in order to use enum or equivalent; in the case of PG it handles the details of `CREATE TYPE`, and on other databases without native enum support can support generation of CHECK constraints. [ticket:1109] [ticket:1511] - types documentation updates - some cleanup on schema/expression docs
* - insert() and update() constructs can now embed bindparam()Mike Bayer2009-10-231-4/+9
| | | | | | | objects using names that match the keys of columns. These bind parameters will circumvent the usual route to those keys showing up in the VALUES or SET clause of the generated SQL. [ticket:1579]
* some cleanupMike Bayer2009-10-211-11/+22
|
* merge r6418 from 0.5, dedupe expressions on clause ident, not string valueMike Bayer2009-10-201-3/+3
| | | | [ticket:1574]
* merged r6416 of 0.5 branch, fix the "numeric" paramstyle and add testsMike Bayer2009-10-201-1/+1
|
* deprecations per [ticket:1498]:Mike Bayer2009-10-152-26/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - deprecated PassiveDefault - use DefaultClause. - the BINARY and MSBinary types now generate "BINARY" in all cases. Omitting the "length" parameter will generate "BINARY" with no length. Use BLOB to generate an unlengthed binary column. - the "quoting='quoted'" argument to MSEnum/ENUM is deprecated. It's best to rely upon the automatic quoting. - "shortname" attribute on bindparam() is removed. - fold_equivalents flag on join is deprecated (will remain until [ticket:1131] is implemented) - "scalar" flag on select() is removed, use select.as_scalar(). - 'transactional' flag on sessionmaker() and others is removed. Use 'autocommit=True' to indicate 'transactional=False'. - 'polymorphic_fetch' argument on mapper() is removed. Loading can be controlled using the 'with_polymorphic' option. - 'select_table' argument on mapper() is removed. Use 'with_polymorphic=("*", <some selectable>)' for this functionality. - 'proxy' argument on synonym() is removed. This flag did nothing throughout 0.5, as the "proxy generation" behavior is now automatic. - Passing a single list of elements to eagerload(), eagerload_all(), contains_eager(), lazyload(), defer(), and undefer() instead of multiple positional -args is deprecated. - Passing a single list of elements to query.order_by(), query.group_by(), query.join(), or query.outerjoin() instead of multiple positional *args is deprecated. - query.iterate_instances() is removed. Use query.instances(). - Query.query_from_parent() is removed. Use the sqlalchemy.orm.with_parent() function to produce a "parent" clause, or alternatively query.with_parent(). - query._from_self() is removed, use query.from_self() instead. - the "comparator" argument to composite() is removed. Use "comparator_factory". - RelationProperty._get_join() is removed. - the 'echo_uow' flag on Session is removed. Use logging on the "sqlalchemy.orm.unitofwork" name. - session.clear() is removed. use session.expunge_all(). - session.save(), session.update(), session.save_or_update() are removed. Use session.add() and session.add_all(). - the "objects" flag on session.flush() remains deprecated. - the "dont_load=True" flag on session.merge() is deprecated in favor of "load=False". - passing an InstanceState (internal SQLAlchemy state object) to attributes.init_collection() or attributes.get_history() is deprecated. These functions are public API and normally expect a regular mapped object instance. - the 'engine' parameter to declarative_base() is removed. Use the 'bind' keyword argument.
* - an executemany() now requires that all bound parameterMike Bayer2009-10-152-14/+28
| | | | | | | | | | | | sets require that all keys are present which are present in the first bound parameter set. The structure and behavior of an insert/update statement is very much determined by the first parameter set, including which defaults are going to fire off, and a minimum of guesswork is performed with all the rest so that performance is not impacted. For this reason defaults would otherwise silently "fail" for missing parameters, so this is now guarded against. [ticket:1566]
* remove instanceof() in favor of memoized flags, part of [ticket:1566]Mike Bayer2009-10-141-9/+7
|
* - added "ddl" argument to the "on" callable of DDLElement [ticket:1538]Mike Bayer2009-10-121-3/+3
| | | | | | - fixed the imports in the "postgres" cleanup dialect - renamed "schema_item" attribute/argument of DDLElement to "target".
* merge from branches/clauseelement-nonzeroPhilip Jenvey2009-09-244-51/+62
| | | | | | adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash collisions (which only occur on Jython) fixes #1547
* - Inserting NULL into a primary key + foreign key columnMike Bayer2009-08-311-2/+1
| | | | | | | | | | | will allow the "not null constraint" error to raise, not an attempt to execute a nonexistent "col_id_seq" sequence. [ticket:1516] - autoincrement SELECT statements, i.e. those which select from a procedure that modifies rows, now work with server-side cursor mode (the named cursor isn't used for such statements.)
* - Fixed an obscure issue whereby a joined-table subclassMike Bayer2009-08-281-1/+12
| | | | | | | with a self-referential eager load on the base class would populate the related object's "subclass" table with data from the "subclass" table of the parent. [ticket:1485]
* doc fixesMike Bayer2009-08-251-18/+18
|
* always visit returning clauses in the right order for positional paramstylePhilip Jenvey2009-08-181-8/+4
| | | | sanity
* - simplify MySQLIdentifierPreparer into standard pattern,Mike Bayer2009-08-101-3/+5
| | | | | | | thus allowing easy subclassing - move % sign logic for MySQLIdentifierPreparer into MySQLdb dialect - paramterize the escape/unescape quote char in IdentifierPreparer - cut out MySQLTableDefinitionParser cruft
* - the Oracle dialect now features NUMBER which intendsMike Bayer2009-08-091-0/+2
| | | | | | | to act justlike Oracle's NUMBER type. It is the primary numeric type returned by table reflection and attempts to return Decimal()/float/int based on the precision/scale parameters. [ticket:885]
* - added **kw to ClauseElement.compare(), so that we can smarten up the ↵Mike Bayer2009-08-081-12/+44
| | | | | | | | | | | | | "use_get" operation - many-to-one relation to a joined-table subclass now uses get() for a simple load (known as the "use_get" condition), i.e. Related->Sub(Base), without the need to redefine the primaryjoin condition in terms of the base table. [ticket:1186] - specifying a foreign key with a declarative column, i.e. ForeignKey(MyRelatedClass.id) doesn't break the "use_get" condition from taking place [ticket:1492]
* clean up the way we detect MSSQL's form of RETURNINGMike Bayer2009-08-081-10/+22
|
* unwrapped _get_colparams a bit, dropped out an isinstance() callMike Bayer2009-08-082-22/+25
|
* - turned on auto-returning for oracle, some errorsMike Bayer2009-08-081-11/+11
| | | | | - added make_transient() [ticket:1052] - ongoing refactor of compiler _get_colparams() (more to come)
* fix non2.4 gremlinMike Bayer2009-08-061-1/+1
|
* merge 0.6 series to trunk.Mike Bayer2009-08-064-546/+1016
|
* merged [ticket:1486] fix from 0.6Mike Bayer2009-07-282-4/+13
|
* - Fixed bug whereby a load/refresh of joined tableMike Bayer2009-07-251-7/+4
| | | | | | inheritance attributes which were based on column_property() or similar would fail to evaluate. [ticket:1480]
* - Unary expressions such as DISTINCT propagate theirMike Bayer2009-07-252-6/+5
| | | | | type handling to result sets, allowing conversions like unicode and such to take place. [ticket:1420]
* - Fixed a bug in extract() introduced in 0.5.4 wherebyMike Bayer2009-07-171-2/+1
| | | | | | the string "field" argument was getting treated as a ClauseElement, causing various errors within more complex SQL transformations.
* - sqlMike Bayer2009-05-292-2/+2
| | | | | | | | | | | | | | | | - Removed an obscure feature of execute() (including connection, engine, Session) whereby a bindparam() construct can be sent as a key to the params dictionary. This usage is undocumented and is at the core of an issue whereby the bindparam() object created implicitly by a text() construct may have the same hash value as a string placed in the params dictionary and may result in an inappropriate match when computing the final bind parameters. Internal checks for this condition would add significant latency to the critical task of parameter rendering, so the behavior is removed. This is a backwards incompatible change for any application that may have been using this feature, however the feature has never been documented.
* - The "polymorphic discriminator" column may be part of aMike Bayer2009-05-171-1/+1
| | | | | primary key, and it will be populated with the correct discriminator value. [ticket:1300]
* - It is now an error to specify both columns of a binary primaryjoinMike Bayer2009-05-081-4/+4
| | | | | | condition in the foreign_keys or remote_side collection. Whereas previously it was just nonsensical, but would succeed in a non-deterministic way.
* Added multi part schema name support. Closes #594 and #1341.Michael Trier2009-04-111-6/+14
|
* - Fixed bug in relation(), introduced in 0.5.3,Mike Bayer2009-04-021-0/+1
| | | | | | whereby a self referential relation from a base class to a joined-table subclass would not configure correctly.
* Lots of fixes to the code examples to specify imports explicitly.Michael Trier2009-03-311-4/+8
| | | | | | | Explicit imports make it easier for users to understand the examples. Additionally a lot of the examples were fixed to work with the changes in the 0.5.x code base. One small correction to the Case expression. Thanks a bunch to Adam Lowry! Fixes #717.
* extract() is now dialect-sensitive and supports SQLite and others.Jason Kirtland2009-03-302-2/+44
|
* - Lazy loader will not use get() if the "lazy load"Mike Bayer2009-03-291-1/+1
| | | | | | | | | SQL clause matches the clause used by get(), but contains some parameters hardcoded. Previously the lazy strategy would fail with the get(). Ideally get() would be used with the hardcoded parameters but this would require further development. [ticket:1357]
* - An alias() of a select() will convert to a "scalar subquery"Mike Bayer2009-03-211-2/+22
| | | | | | when used in an unambiguously scalar context, i.e. it's used in a comparison operation. This applies to the ORM when using query.subquery() as well.
* - Query.join() can now construct multiple FROM clauses, ifMike Bayer2009-03-151-8/+24
| | | | | | | needed. Such as, query(A, B).join(A.x).join(B.y) might say SELECT A.*, B.* FROM A JOIN X, B JOIN Y. Eager loading can also tack its joins onto those multiple FROM clauses. [ticket:1337]