summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
Commit message (Collapse)AuthorAgeFilesLines
...
| * - The REFERENCES clause in a CREATE TABLE that includesMike Bayer2010-11-121-1/+6
| | | | | | | | | | a remote schema name now renders the remote name without the schema clause, as required by SQLite. [ticket:1851]
| * - Added type_coerce(expr, type_) expression element.Mike Bayer2010-10-231-2/+6
| | | | | | | | | | | | Treats the given expression as the given type when evaluating expressions and processing result rows, but does not affect the generation of SQL, other than an anonymous label.
* | merge tipMike Bayer2010-09-191-0/+4
|\ \ | |/
| * - An informative error message is raised if a ColumnMike Bayer2010-09-181-0/+4
| | | | | | | | | | | | | | | | | | which has not yet been assigned a name, i.e. as in declarative, is used in a context where it is exported to the columns collection of an enclosing select() construct, or if any construct involving that column is compiled before its name is assigned. [ticket:1862]
* | - move LIMIT/OFFSET rendering to be as bind parameters, for all backendsMike Bayer2010-08-291-3/+3
|/ | | | | | | | | | which support it. This includes SQLite, MySQL, Postgresql, Firebird, Oracle (already used binds with ROW NUMBER OVER), MSSQL (when ROW NUMBER is used, not TOP). Not included are Informix, Sybase, MaxDB, Access [ticket:805] - LIMIT/OFFSET parameters need to stay as literals within SQL constructs. This because they may not be renderable as binds on some backends.
* - The generated index name also is based onMike Bayer2010-08-021-2/+4
| | | | | | | | a "max index name length" attribute which is separate from the "max identifier length" - this to appease MySQL who has a max length of 64 for index names, separate from their overall max length of 255. [ticket:1412]
* - Changed the scheme used to generate truncatedMike Bayer2010-07-211-15/+15
| | | | | | | | | | | | "auto" index names when using the "index=True" flag on Column. The truncation only takes place with the auto-generated name, not one that is user-defined (an error would be raised instead), and the truncation scheme itself is now based on a fragment of an md5 hash of the identifier name, so that multiple indexes on columns with similar names still have unique names. [ticket:1855]
* - The argument to "ESCAPE" of a LIKE operator or similarMike Bayer2010-06-241-4/+12
| | | | | | | | | | | | | | | | is passed through render_literal_value(), which may implement escaping of backslashes. [ticket:1400] - Postgresql render_literal_value() is overridden which escapes backslashes, currently applies to the ESCAPE clause of LIKE and similar expressions. Ultimately this will have to detect the value of "standard_conforming_strings" for full behavior. [ticket:1400] - MySQL render_literal_value() is overridden which escapes backslashes, currently applies to the ESCAPE clause of LIKE and similar expressions. This behavior is derived from detecting the value of NO_BACKSLASH_ESCAPES. [ticket:1400]
* - Fixed concatenation of constraints when "PRIMARY KEY"Mike Bayer2010-05-271-4/+4
| | | | | | | constraint gets moved to column level due to SQLite AUTOINCREMENT keyword being rendered. [ticket:1812] - remove some extra space in between constraint DDL - added alias() to binary comparison test, fixing pg + mysql failures
* - Fixed errant space character when generating ADD CONSTRAINTMike Bayer2010-04-261-1/+1
| | | | for a named UNIQUE constraint.
* much more descriptive message for bind param name conflict, [ticket:1766]Mike Bayer2010-04-121-6/+12
|
* - Added with_hint() method to Query() construct. This callsMike Bayer2010-03-271-12/+55
| | | | | | | | | | directly down to select().with_hint() and also accepts entities as well as tables and aliases. See with_hint() in the SQL section below. [ticket:921] - Added with_hint() method to select() construct. Specify a table/alias, hint text, and optional dialect name, and "hints" will be rendered in the appropriate place in the statement. Works for Oracle, Sybase, MySQL. [ticket:921]
* - Fixed bug introduced in 0.6beta2 where column labels wouldMike Bayer2010-03-231-4/+7
| | | | | render inside of column expressions already assigned a label. [ticket:1747]
* - added pyodbc for sybase driver.Mike Bayer2010-03-171-35/+106
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - generalized the "freetds" / "unicode statements" behavior of MS-SQL/pyodbc into the base Pyodbc connector, as this seems to apply to Sybase as well. - generalized the python-sybase "use autocommit for DDL" into the pyodbc connector. With pyodbc, the "autocommit" flag on connection is used, as Pyodbc seems to have more database conversation than python-sybase that can't otherwise be suppressed. - Some platforms will now interpret certain literal values as non-bind parameters, rendered literally into the SQL statement. This to support strict SQL-92 rules that are enforced by some platforms including MS-SQL and Sybase. In this model, bind parameters aren't allowed in the columns clause of a SELECT, nor are certain ambiguous expressions like "?=?". When this mode is enabled, the base compiler will render the binds as inline literals, but only across strings and numeric values. Other types such as dates will raise an error, unless the dialect subclass defines a literal rendering function for those. The bind parameter must have an embedded literal value already or an error is raised (i.e. won't work with straight bindparam('x')). Dialects can also expand upon the areas where binds are not accepted, such as within argument lists of functions (which don't work on MS-SQL when native SQL binding is used).
| * - mxodbc can use default execute() callMike Bayer2010-03-161-29/+77
|/ | | | | | | | | | | | | - modified SQLCompiler to support rendering of bind parameters as literal inline strings for specific sections, if specified by the compiler subclass, using either literal_binds=True passed to process() or any visit method, or by setting to False the "binds_in_columns_clause" flag for SQL-92 compatible columns clauses.. The compiler subclass is responsible for implementing the literal quoting function which should make use of the DBAPI's native capabilities. - SQLCompiler now passes **kw to most process() methods (should be all, ideally) so that literal_binds is propagated. - added some rudimentary tests for mxodbc.
* - The except_() method now renders as MINUS on Oracle,Mike Bayer2010-03-161-1/+14
| | | | | which is more or less equivalent on that platform. [ticket:1712]
* -remove proof of concept "cascade constraints"Mike Bayer2010-02-281-4/+1
|
* working on pyodbc / mxodbcMike Bayer2010-02-271-0/+1
|
* - Composite PK table on InnoDB where the "autoincrement" columnMike Bayer2010-02-221-12/+16
| | | | | isn't first will emit an explicit "KEY" phrase within CREATE TABLE thereby avoiding errors, [ticket:1496]
* - A change to the solution for [ticket:1579] - an end-userMike Bayer2010-02-161-16/+27
| | | | | | | | defined bind parameter name that directly conflicts with a column-named bind generated directly from the SET or VALUES clause of an update/insert generates a compile error. This reduces call counts and eliminates some cases where undesirable name conflicts could still occur.
* tighten up conditionals a bit. this method is still doing too much, i.e. ↵Mike Bayer2010-02-161-42/+51
| | | | the whole pre-visit step is pricey.
* add sql_compiler property to all Compiled subclasses for convenienceMike Bayer2010-02-071-0/+4
|
* dont reference self.statement during compilationMike Bayer2010-02-071-1/+1
|
* - Added math negation operator support, -x.Mike Bayer2010-02-051-0/+1
|
* - types.Binary is renamed to types.LargeBinary, it onlyMike Bayer2010-01-231-1/+7
| | | | | | | produces BLOB, BYTEA, or a similar "long binary" type. New base BINARY and VARBINARY types have been added to access these MySQL/MS-SQL specific types in an agnostic way [ticket:1664].
* fixed the illegal_initial_chars collection + unit test, [ticket:1659]Mike Bayer2010-01-211-1/+1
|
* happy new yearMike Bayer2010-01-071-1/+1
|
* - 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
* - reworked the DDL generation of ENUM and similar to be more platform agnostic.Mike Bayer2009-12-061-21/+11
| | | | | | | 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.
* - 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]
* - generalized Enum to issue a CHECK constraint + VARCHAR on default platformMike Bayer2009-10-251-6/+23
| | | | - 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-251-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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]
* 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-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-151-8/+15
| | | | | | | | | | | | 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-241-5/+5
| | | | | | 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.)
* 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]
* 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-081-22/+23
|
* - 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-061-334/+538
|
* - Unary expressions such as DISTINCT propagate theirMike Bayer2009-07-251-2/+2
| | | | | type handling to result sets, allowing conversions like unicode and such to take place. [ticket:1420]