Commit Graph

722 Commits

Author SHA1 Message Date
Mike Bayer 71e043aaae - attempt to clarify what mutable extension does for HSTORE, [ticket:2803] 2013-10-18 19:34:58 -04:00
Mike Bayer fff9079909 - Removed a 128-character truncation from the reflection of the
server default for a column; this code was original from
PG system views which truncated the string for readability.
[ticket:2844]
2013-10-18 19:00:05 -04:00
Mike Bayer ca02882c6a - The change in 🎫2721, which is that the `deferrable` keyword
of :class:`.ForeignKeyConstraint` is silently ignored on the MySQL
backend, will be reverted as of 0.9; this keyword will now render again, raising
errors on MySQL as it is not understood - the same behavior will also
apply to the ``initially`` keyword.  In 0.8, the keywords will remain
ignored but a warning is emitted.   Additionally, the ``match`` keyword
now raises a :class:`.CompileError` on 0.9 and emits a warning on 0.8;
this keyword is not only silently ignored by MySQL but also breaks
the ON UPDATE/ON DELETE options.

To use a :class:`.ForeignKeyConstraint`
that does not render or renders differently on MySQL, use a custom
compilation option.  An example of this usage has been added to the
documentation, see :ref:`mysql_foreign_keys`.
[ticket:2721] [ticket:2839]
2013-10-18 14:44:01 -04:00
Mike Bayer a5dc173ea6 - Added support for rendering `SMALLSERIAL when a :class:.SmallInteger`
type is used on a primary key autoincrement column, based on server
version detection of Postgresql version 9.2 or greater.
[ticket:2840]
2013-10-15 19:06:21 -04:00
Mike Bayer 92534dc8f3 The MySQL :class:.mysql.SET type now features the same auto-quoting
behavior as that of :class:`.mysql.ENUM`.  Quotes are not required when
setting up the value, but quotes that are present will be auto-detected
along with a warning.  This also helps with Alembic where
the SET type doesn't render with quotes. [ticket:2817]
2013-10-14 16:12:54 -04:00
Mike Bayer 366e74b1be MySQL-connector dialect now allows options in the create_engine
query string to override those defaults set up in the connect,
including "buffered" and "raise_on_warnings".
[ticket:2515]
2013-10-13 14:09:35 -04:00
Mike Bayer a2cce1bf43 Parenthesis will be applied to a compound SQL expression as
rendered in the column list of a CREATE INDEX statement.
[ticket:2742]
2013-10-12 20:21:18 -04:00
Mike Bayer 9bc9d5c106 - Fixed bug in default compiler plus those of postgresql, mysql, and
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.
2013-10-12 20:04:55 -04:00
Mike Bayer 94d421ca2f - put exact version string in the test
- use match with a .* preceding instead of search
2013-09-29 17:24:29 -04:00
Scott Schaefer f7504bdbad re.match to re.search
Convert to re.search to eliminate the restriction on only matching the
beginning of the string
2013-09-06 18:14:26 -06:00
Mike Bayer b727d05ce1 add caveats regarding RETURNING 2013-09-02 12:33:49 -04:00
Mike Bayer 7bf231232c - cx_oracle seems to have a bug here though it is hard to track down
- cx_oracle dialect doesn't use normal col names, lets just not rely on that for now
2013-08-27 21:37:22 -04:00
Mike Bayer 031ef08078 - A rework to the way that "quoted" identifiers are handled, in that
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]
2013-08-27 20:43:22 -04:00
Mike Bayer 4268ea06b3 move FAQ to the docs, [ticket:2133] 2013-08-21 18:48:34 -04:00
Mike Bayer b83a1564f1 Improved support for the cymysql driver, supporting version 0.6.5,
courtesy Hajime Nakagami.
2013-08-17 00:31:57 -04:00
Mike Bayer f6198d9abf - A large refactoring of the `sqlalchemy.sql` package has reorganized
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.
2013-08-12 17:50:37 -04:00
Mike Bayer 25839c064d Updates to MySQL reserved words for versions 5.5, 5.6, courtesy
Hanno Schlichting.  Also in 0.8.3, 0.7.11.
[ticket:2791]
2013-07-31 21:05:33 -04:00
Mike Bayer fd8b2d188c doc fix 2013-07-12 22:01:58 -04:00
Mike Bayer 63488b2d1e The newly added SQLite DATETIME arguments storage_format and
regexp apparently were not fully implemented correctly; while the
arguments were accepted, in practice they would have no effect;
this has been fixed.  Also in 0.8.3.
[ticket:2781]
2013-07-12 21:52:54 -04:00
Mike Bayer cd8a40284d - we dont actually need this unicode cast, on py3k + linux it seems the
has_table issues are OK.  On OSX forget it.
- still some issues with PY3k + pyodbc + decimal values it doesn't expect, not sure
2013-07-09 11:52:31 -04:00
Mike Bayer 1fb6c4a33d Added :class:.BIGINT to the list of type names that can be
reflected by the SQLite dialect; courtesy Russell Stuart.
[ticket:2764]
2013-07-02 18:10:08 -04:00
Mike Bayer 868da0c281 Added new flag `retaining=False` to the kinterbasdb and fdb dialects.
This controls the value of the ``retaining`` flag sent to the
``commit()`` and ``rollback()`` methods of the DBAPI connection.
Defaults to False.  Also in 0.8.2, where it defaults to True.
[ticket:2763]
2013-06-30 19:48:48 -04:00
Mike Bayer d875f677a3 The behavior of :func:.extract has been simplified on the
Postgresql dialect to no longer inject a hardcoded ``::timestamp``
or similar cast into the given expression, as this interfered
with types such as timezone-aware datetimes, but also
does not appear to be at all necessary with modern versions
of psycopg2.  Also in 0.8.2.
[ticket:2740]
2013-06-28 23:53:27 -04:00
Mike Bayer bccf8ff5b1 Type lookup when reflecting the Firebird types LONG and
INT64 has been fixed so that LONG is treated as INTEGER,
INT64 treated as BIGINT, unless the type has a "precision"
in which case it's treated as NUMERIC.  Patch courtesy
Russell Stuart.
[ticket:2757]
2013-06-28 11:49:41 -04:00
Mike Bayer 04b66bc5e7 Fixed bug in HSTORE type where keys/values that contained
backslashed quotes would not be escaped correctly when
using the "non native" (i.e. non-psycopg2) means
of translating HSTORE data.  Patch courtesy Ryan Kelly.
[ticket:2766]
2013-06-28 11:35:57 -04:00
Mike Bayer f76e65727d Merge branch 'ticket_2746'
Conflicts:
	doc/build/changelog/changelog_08.rst
	doc/build/changelog/changelog_09.rst
2013-06-26 13:24:07 -04:00
Mike Bayer f76cae4bc9 - rework of correlation, continuing on #2668, #2746
- add support for correlations to propagate all the way in; because
correlations require context now, need to make sure a select enclosure
of any level takes effect any number of levels deep.
- fix what we said correlate_except() was supposed to do when we first
released #2668 - "the FROM clause is left intact if the correlated SELECT
is not used in the context of an enclosing SELECT..." - it was not
considering the "existing_froms" collection at all, and prohibited
additional FROMs from being placed in an any() or has().
- add test for multilevel any()
- lots of docs, including glossary entries as we really need to define
"WHERE clause", "columns clause" etc. so that we can explain correlation better
- based on the insight that a SELECT can correlate anything that ultimately
came from an enclosing SELECT that links to this one via WHERE/columns/HAVING/ORDER BY,
have the compiler keep track of the FROM lists that correspond in this way,
link it to the asfrom flag, so that we send to _get_display_froms() the exact
list of candidate FROMs to correlate.  no longer need any asfrom logic in the
Select() itself
- preserve 0.8.1's behavior for correlation when no correlate options are given, not
to mention 0.7 and prior's behavior of not propagating implicit correlation more than one level..
this is to reduce surprises/hard-to-debug situations when a user isn't trying
to correlate anything.
2013-06-26 13:19:45 -04:00
Roman Podolyaka 0333ee23d3 Fix indexes reflection in PostgreSQL
Reflection of indexes must preserve the order of columns.

Fixes issue 2767.
2013-06-26 08:31:33 +03:00
Roman Podolyaka 3a80bf0d50 Fix unique constraints reflection in PostgreSQL
Reflection of unique constraints must preserve the order of columns.
2013-06-23 13:35:19 +03:00
Roman Podolyaka 1ad06ea42c Fix unique constraints reflection in SQLite
If SQLite keywords are used as column names, they are
quoted. The code parsing the information about table
unique constraints should be modified so that it properly
removes double-quotes from column names.
2013-06-23 10:42:03 +03:00
Mike Bayer 38b5495511 versionadds 2013-06-22 11:48:33 -04:00
Mike Bayer 62dc627219 - 0.8 changelog
- some whitespace
2013-06-22 11:40:32 -04:00
mike bayer 29fa6913be Merge pull request #5 from cjw296/pg-ranges
Support for Postgres range types.
2013-06-22 07:47:02 -07:00
Mike Bayer 4517a854bc fix up the isolation level docs which were a mess 2013-06-17 23:12:04 -04:00
Mike Bayer d826d99544 - changelog
- docs
2013-06-15 22:58:04 -04:00
Roman Podolyaka a1ceae2ed3 Add AUTOCOMMIT isolation level support for psycopg2
One can use this to emit statements, which can not be
executed within a transaction (e. g. CREATE DATABASE):

    from sqlalchemy import create_engine

    eng = create_engine('postgresql://test:test@localhost/test')

    conn = eng.connect().execution_options(isolation_level='AUTOCOMMIT')
    conn.execute('CREATE DATABASE test2;')

Fixes issue #2072.
2013-06-15 16:54:50 +03:00
Chris Withers b2da12e070 Documentation for the new range type support. 2013-06-10 13:24:02 +01:00
Chris Withers b2ea2eef5d Implement EXCLUDE constraints for postgres. 2013-06-10 12:09:56 +01:00
Chris Withers f4020282b7 add support for range operators listed in http://www.postgresql.org/docs/9.2/interactive/functions-range.html 2013-06-10 12:09:55 +01:00
Chris Withers 70edfa229c Basic type support for the new range types in postgres 9.2 2013-06-10 12:09:55 +01:00
Mike Bayer 1652491cc6 this comment is ancient 2013-06-09 20:36:37 -04:00
Roman Podolyaka c69fe4acf8 Add basic support of unique constraints reflection
Inspection API already supports reflection of table
indexes information and those also include unique
constraints (at least for PostgreSQL and MySQL).
But it could be actually useful to distinguish between
indexes and plain unique constraints (though both are
implemented in the same way internally in RDBMS).

This change adds a new method to Inspection API - get_unique_constraints()
and implements it for SQLite, PostgreSQL and MySQL dialects.
2013-06-09 23:49:55 +03:00
Mike Bayer 85368d25ed get nested joins to render on oracle 8 2013-06-08 18:54:14 -04:00
mike bayer 659baac85e Merge pull request #3 from bslatkin/master
Makes gaerdbms for App Engine use local MySQL server when running in dev_appserver2
2013-06-08 12:11:25 -07:00
Mike Bayer a80bb53934 - changelog for [ticket:2704]
- use an isinstance() check, concerned a TypeError might be indiscriminate
2013-06-08 14:47:04 -04:00
Roman Podolyaka 4cc9d482ae Fix using of 'mysql_length' for composite indexes
Currently, one can specify the prefix length for an index
column using 'mysql_length' keyword argument when creating
an Index instance. But in case of composite indexes the
prefix length value is applied only to the last column.

Extend the existing API in way so that 'mysql_length' argument
value can be either:
    - an integer specifying the same prefix length value
      for each column of an index
    - a (column_name --> integer value) mapping specifying
      the prefix length value for each column of an index
      separately

Fixes issue #2704.
2013-06-08 20:56:28 +03:00
Brett Slatkin c8f9831a66 Fixing the error regex to match numbers with the long suffix, like 1146L 2013-06-08 02:04:27 -07:00
Brett Slatkin 3472083ba9 PEP8 2013-06-08 00:15:37 -07:00
Brett Slatkin 2dee20448c Makes gaerdbms for App Engine use local MySQL server when running under dev_appserver2. 2013-06-08 00:10:26 -07:00
Mike Bayer 0d9ec9fe84 remove all remaining start/end py2k/py3k blocks 2013-06-07 17:51:12 -04:00