Commit Graph

803 Commits

Author SHA1 Message Date
Mike Bayer 67e0f356b2 - A TypeDecorator of Integer can be used with a primary key
column, and the "autoincrement" feature of various dialects
  as well as the "sqlite_autoincrement" flag will honor
  the underlying database type as being Integer-based.
 [ticket:2005]

- Result-row processors are applied to pre-executed SQL
  defaults, as well as cursor.lastrowid, when determining
  the contents of result.inserted_primary_key.
  [ticket:2006]

- Bind parameters present in the "columns clause" of a select
  are now auto-labeled like other "anonymous" clauses,
  which among other things allows their "type" to be meaningful
  when the row is fetched, as in result row processors.

- TypeDecorator is present in the "sqlalchemy" import space.
2011-01-11 15:22:46 -05:00
Mike Bayer 6e023b1665 - Firebird numeric type now checks for Decimal explicitly,
lets float() pass right through, thereby allowing
special values such as float('inf'). [ticket:2012]
2011-01-03 21:11:12 -05:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Mike Bayer 426c4356eb - removes the "on_" prefix. 2010-12-30 14:22:43 -05:00
Mike Bayer dff4e0591e - apply pep8 to compiler.py
- deprecate Compiled.compile() - have __init__ do compilation
if statement is present.
2010-12-21 16:34:00 -05:00
Mike Bayer 54085a0e6a - MSSQL - the String/Unicode types, and their counterparts VARCHAR/
NVARCHAR, emit "max" as the length when no length is
specified.   This makes it more compatible with Postgresql's
VARCHAR type which is similarly unbounded when no length
specified.
2010-12-16 17:52:43 -05:00
Mike Bayer c691b4cbdf - support for cdecimal
- add --with-cdecimal flag to tests, monkeypatches cdecimal in
- fix mssql/pyodbc.py to not use private '_int' accessor in decimal conversion
routines
- pyodbc version 2.1.8 is needed for cdecimal in any case as
previous versions also called '_int', 2.1.8 adds the same string
logic as our own dialect, so that logic is skipped for modern
pyodbc version
- make the imports for "Decimal" consistent across the whole lib.  not sure
yet how we should be importing "Decimal" or what the best way forward
is that would allow a clean user-invoked swap of cdecimal; for now,
added docs suggesting a global monkeypatch - the two decimal libs
are not compatible with each other so any chance of mixing produces
serious issues.  adding adapters to DBAPIs tedious and adds in-python
overhead.  suggestions welcome on how we should be doing
Decimal/cdecimal.
2010-12-11 17:44:46 -05:00
Mike Bayer 83be34c047 - hardwire the huge LIMIT number on MySQL. this might fix the OurSQL py3k
bug we're having, though I'm not able to get a good run of OurSQL
on OSX right now either Python 2 or 3.
2010-12-06 18:45:19 -05:00
Mike Bayer f1e54a69fb - merge default tip 2010-12-05 14:56:26 -05:00
Mike Bayer df7379f992 - modernize multiple warning assertions for PG reflect index test 2010-11-30 20:39:06 -05:00
Mike Bayer 582b12152e - Fixed bug whereby KeyError would occur with non-ENUM
supported PG versions after a pool dispose+recreate
would occur, [ticket:1989]
2010-11-30 13:55:17 -05:00
Mike Bayer 35bfda533e - repair MS-SQL handling of LIMIT/OFFSET as binds, add bindparam() to the compile stream
so they function correctly
2010-11-29 17:28:36 -05:00
Mike Bayer 58b2939433 - sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".

Rationale:

- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options

[ticket:1949]
2010-11-28 14:19:44 -05:00
Mike Bayer d14d171772 - the "mutable" flag on PickleType, postgresql.ARRAY is now off
by default.  [ticket:1980]
2010-11-28 12:16:39 -05:00
Mike Bayer 61840abbce - NullPool is now used by default for SQLite file-
based databases.  :memory: databases will continue
 to select SingletonThreadPool by default.
 [ticket:1921]
2010-11-28 12:00:01 -05:00
Mike Bayer 77f641429f - Fixed operator precedence rules for multiple
chains of a single non-associative operator.
I.e. "x - (y - z)" will compile as "x - (y - z)"
and not "x - y - z".  Also works with labels,
i.e. "x - (y - z).label('foo')"
[ticket:1984]
- Single element tuple expressions inside an IN clause
parenthesize correctly, also from [ticket:1984],
added tests for PG
- re-fix again importlater, [ticket:1983]
2010-11-25 12:20:13 -05:00
Mike Bayer 45cdb17ef0 - fixes for PG, mysql, twophase
- added "pool_events" arg to create_engine(), "events" to pool, allowing
establishment of listeners which fire before those of the dialect
2010-11-20 17:57:30 -05:00
Mike Bayer 3412df1292 - merge limit/offset as binds branch, [ticket:805] 2010-11-20 12:57:51 -05:00
Mike Bayer e15fa0342d skip on 2.4 2010-11-18 20:12:24 -05:00
Mike Bayer fd4f39648a merge tip 2010-11-18 18:57:33 -05:00
Mike Bayer c4fc40e5fc merge tip 2010-11-18 18:52:51 -05:00
Mike Bayer 2336b1cebf - Added as_uuid=True flag to the UUID type, will receive
and return values as Python UUID() objects rather than
strings.  Currently, the UUID type is only known to
work with psycopg2.  [ticket:1956]
2010-11-18 18:44:35 -05:00
Mike Bayer 34cb747f64 - Ensured every numeric, float, int code, scalar + array,
are recognized by psycopg2 and pg8000's "numeric"
base type. [ticket:1955]
2010-11-18 18:10:03 -05:00
Mike Bayer 3d72efba2b - fix test specification for oracle euro test 2010-11-18 15:03:25 -05:00
Mike Bayer 37644a64ec - The cx_oracle "decimal detection" logic, which takes place
for for result set columns with ambiguous numeric characteristics,
now uses the decimal point character determined by the locale/
NLS_LANG setting, using an on-first-connect detection of
this character.  cx_oracle 5.0.3 or greater is also required
when using a non-period-decimal-point NLS_LANG setting.
[ticket:1953].
2010-11-18 12:19:31 -05:00
Mike Bayer e1402efb19 - move sqlalchemy.test to test.lib 2010-11-15 19:37:50 -05:00
Mike Bayer 6fb06409c6 merge tip 2010-11-14 18:25:13 -05:00
Mike Bayer d3ee4f6155 - On the same theme, the REFERENCES clause in a CREATE TABLE
that includes a remote schema to a *different* schema
than that of the parent table doesn't render at all,
as cross-schema references do not appear to be supported.
2010-11-12 10:49:17 -05:00
Mike Bayer bbe3f0a27c - The REFERENCES clause in a CREATE TABLE that includes
a remote schema name now renders the remote name without
the schema clause, as required by SQLite.  [ticket:1851]
2010-11-12 10:36:03 -05:00
Mike Bayer a29f130be7 - mssql+pymssql dialect now honors the "port" portion
of the URL instead of discarding it.  [ticket:1952]
- testing.only_on() accepts db specs optionally as a list
2010-10-24 12:00:58 -04:00
Mike Bayer 9c0d6c0a23 - Rewrote the reflection of indexes to use sys.
catalogs, so that column names of any configuration
(spaces, embedded commas, etc.) can be reflected.
Note that reflection of indexes requires SQL
Server 2005 or greater.  [ticket:1770]
2010-10-23 18:09:36 -04:00
Mike Bayer c01c6baf57 - Oracle - the implicit_retunring argument to create_engine()
is now honored regardless of detected version of
Oracle.  Previously, the flag would be forced
to False if server version info was < 10.
[ticket:1878]
2010-10-23 15:27:21 -04:00
Mike Bayer f3c9c87a24 - Fixed mysql bug involving reflection of CURRENT_TIMESTAMP
default used with ON UPDATE clause, thanks to
Taavi Burns [ticket:1940]
2010-10-20 17:44:35 -04:00
Mike Bayer 60197fb0f4 - Fixed bug which prevented "domain" built from a
custom type such as "enum" from being reflected.
[ticket:1933]
2010-10-20 17:28:08 -04:00
Mike Bayer 42ac34a701 - Added "as_tuple" flag to pg ARRAY type, returns results
as tuples instead of lists to allow hashing.
2010-10-20 16:17:17 -04:00
Mike Bayer db318240d1 - Fixed bug where aliasing of tables with "schema" would
fail to compile properly.  [ticket:1943]
2010-10-20 16:15:54 -04:00
Mike Bayer a714db53b3 - Fixed MSSQL reflection bug which did not properly handle
reflection of unknown types.  [ticket:1946]
2010-10-16 12:15:40 -04:00
Mike Bayer 761b4f29e2 - *Major* cleanup / modernization of the Informix
dialect for 0.6, courtesy Florian Apolloner.
[ticket:1906]
2010-10-01 21:26:05 -04:00
Mike Bayer 90c8d8e0c9 merge tip 2010-09-19 16:11:16 -04:00
Mike Bayer d2bff71138 - Fixed FB bug whereby a column default would fail to
reflect if the "default" keyword were lower case.
2010-09-06 13:41:59 -04:00
Mike Bayer ccde531935 - query.with_parent() now accepts transient objects
and will use the non-persistent values of their pk/fk
attributes in order to formulate the criterion.
Docs are also clarified as to the purpose of with_parent().
- fix for PG test executing an alias()
2010-09-06 10:55:53 -04:00
Mike Bayer 36fa24603f - Oracle reflection of indexes has been tuned so
that indexes which include some or all primary
key columns, but not the same set of columns
as that of the primary key, are reflected.
Indexes which contain the identical columns
as that of the primary key are skipped within
reflection, as the index in that case is assumed
to be the auto-generated primary key index.
Previously, any index with PK columns present
would be skipped.  Thanks to Kent Bower
for the patch.  [ticket:1867]

- Oracle now reflects the names of primary key
constraints - also thanks to Kent Bower.
[ticket:1868]
2010-08-29 17:06:05 -04:00
Mike Bayer e4bc7d2894 - move LIMIT/OFFSET rendering to be as bind parameters, for all backends
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.
2010-08-29 16:35:02 -04:00
Mike Bayer 7c63679bdb - Added ROWID type to the Oracle dialect, for those
cases where an explicit CAST might be needed.
[ticket:1879]
2010-08-29 15:16:02 -04:00
Mike Bayer a793b8e050 - Fixed the psycopg2 dialect to use its
set_isolation_level() method instead of relying
upon the base "SET SESSION ISOLATION" command,
as psycopg2 resets the isolation level on each new
transaction otherwise.
2010-08-10 10:24:02 -04:00
Mike Bayer b2c0b50bbf - The generated index name also is based on
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]
2010-08-02 01:12:03 -04:00
Mike Bayer 10db67be5b - More tweaks to cx_oracle Decimal handling.
"Ambiguous" numerics with no decimal place
are coerced to int at the connection handler
level.  The advantage here is that ints
come back as ints without SQLA type
objects being involved and without needless
conversion to Decimal first.

Unfortunately, some exotic subquery cases
can even see different types between
individual result rows, so the Numeric
handler, when instructed to return Decimal,
can't take full advantage of "native decimal"
mode and must run isinstance() on every value
to check if its Decimal already. Reopen of
[ticket:1840]
2010-07-14 14:50:45 -04:00
Mike Bayer e430aa915f test/dialect 2010-07-11 14:28:21 -04:00
Mike Bayer 8548ca8cc5 - add typing/operator converts to Float/Numeric to get Oracle tests going again,
as we have an unusually high level of dependence on SQLA typing now
- force oracle seqs to return integers
2010-07-02 13:55:24 -04:00
Mike Bayer 64d92c836c - If server_version_info is outside the usual
range of (8, ), (9, ), (10, ), a warning is emitted
which suggests checking that the FreeTDS version
configuration is using 7.0 or 8.0, not 4.2.
[ticket:1825]
2010-07-02 12:57:15 -04:00