Commit Graph

436 Commits

Author SHA1 Message Date
Mike Bayer 71c0011574 - [feature] Added a new system
for registration of new dialects in-process
without using an entrypoint.  See the
docs for "Registering New Dialects".
[ticket:2462]
2012-04-24 13:00:30 -04:00
Mike Bayer 998c66fa8b - [feature] The column_reflect event now
accepts the Inspector object as the first
argument, preceding "table".   Code which
uses the 0.7 version of this very new
event will need modification to add the
"inspector" object as the first argument.
[ticket:2418]
2012-04-24 12:01:04 -04:00
Mike Bayer 54017d9de2 merge patch for [ticket:2208]. This still needs documentation. 2012-04-23 12:03:54 -04:00
Mike Bayer 9273cdd638 - [bug] If conn.begin() fails when calling
"with engine.begin()", the newly acquired
Connection is closed explicitly before
propagating the exception onward normally.
2012-04-12 14:38:52 -04:00
Mike Bayer 5280f26d45 - [feature] Added new connection event
dbapi_error(). Is called for all DBAPI-level
errors passing the original DBAPI exception
before SQLAlchemy modifies the state
of the cursor.
2012-04-10 19:38:22 -04:00
Mike Bayer f1bdd4e4bb begin implementing inspection system for #2208 2012-04-03 18:53:39 -04:00
Philip Jenvey 94e05e3d87 cleanup test_processors, modeling the PEP 399 style 2012-03-07 21:48:36 -08:00
Mike Bayer 7feaad21e6 test failures 2012-02-15 10:13:47 -05:00
Mike Bayer df15546cb8 - [feature] Added "no_parameters=True" execution
option for connections.   If no parameters
    are present, will pass the statement
    as cursor.execute(statement), thereby invoking
    the DBAPIs behavior when no parameter collection
    is present; for psycopg2 and mysql-python, this
    means not interpreting % signs in the string.
    This only occurs with this option, and not
    just if the param list is blank, as otherwise
    this would produce inconsistent behavior
    of SQL expressions that normally escape percent
    signs (and while compiling, can't know ahead of
    time if parameters will be present in
    some cases).  [ticket:2407]
2012-02-13 20:07:44 -05:00
Mike Bayer 04c7bae308 - test failures. one in particular seems to be a weird oursql bug, oh well 2012-02-12 20:00:44 -05:00
Mike Bayer d101c597f5 - [feature] Added support for the "isolation_level"
parameter to all MySQL dialects.  Thanks
to mu_mind for the patch here. [ticket:2394]
- add documentation examples for mysql, postgresql
- pep8ing
2012-02-12 18:07:41 -05:00
Mike Bayer 345de2ee1d - [bug] Fixed bug in new "autoload_replace" flag
which would fail to preserve the primary
key constraint of the reflected table.
[ticket:2402]
2012-02-12 17:14:34 -05:00
Mike Bayer c710f6cbf6 - add a context manager availble via Engine.begin()
- add a test suite for all the Engine/Connection/TLEngine transaction/begin
helpers/context managers
- update docs
2012-02-12 16:43:26 -05:00
Mike Bayer 132f5c7e04 - [feature] Added pool_reset_on_return argument
to create_engine, allows control over
"connection return" behavior.  Also added
new arguments 'rollback', 'commit', None
to pool.reset_on_return to allow more control
over connection return activity. [ticket:2378]
2012-02-01 10:14:28 -05:00
Mike Bayer 96dce7686c - [feature] New reflection feature "autoload_replace";
when set to False on Table, the Table can be autoloaded
without existing columns being replaced.  Allows
more flexible chains of Table construction/reflection
to be constructed, including that it helps with
combining Declarative with table reflection.
See the new example on the wiki.  [ticket:2356]

- [bug] Improved the API for add_column() such that
if the same column is added to its own table,
an error is not raised and the constraints
don't get doubled up.  Also helps with some
reflection/declarative patterns. [ticket:2356]
2012-01-28 15:54:28 -05:00
Mike Bayer b7f7ed2105 fix a few py3k bugs 2012-01-28 15:32:53 -05:00
Mike Bayer 780cd9dce4 - [bug] Fixed bug in "mock" strategy whereby
correct DDL visit method wasn't called, resulting
in "CREATE/DROP SEQUENCE" statements being
duplicated [ticket:2384]
2012-01-28 14:29:26 -05:00
Mike Bayer 3e6d1b0845 exception pickling fails on cx_oracle 2012-01-22 22:37:23 -05:00
Mike Bayer 09a503e497 - [bug] Fixed bug whereby a table-bound Column
object named "<a>_<b>" which matched a column
labeled as "<tablename>_<colname>" could match
inappropriately when targeting in a result
set row.  [ticket:2377]
- requires that we change the tuple format in RowProxy.
Makes an improvement to the cases tested against
an unpickled RowProxy as well though doesn't solve the
problem there entirely.
2012-01-22 14:04:20 -05:00
Mike Bayer 959d7cbe33 - [bug] Improved error messages when a non-string
or invalid string is passed to any of the
date/time processors used by SQLite, including
C and Python versions.  [ticket:2382]
- changed the import model of processors.py so that we can
get at the pure python versions and C versions simultaneously
in tests.
2012-01-22 12:11:13 -05:00
Mike Bayer 7026ffe57c another serializable for [ticket:2371] 2012-01-12 00:49:02 -05:00
Mike Bayer 26625d897f further fixes for column/table errors 2012-01-11 20:47:53 -05:00
Mike Bayer 70383385d2 some adjustments for py3k 2012-01-11 20:45:28 -05:00
Mike Bayer b4fcdc19a8 fix failures for oursql, python 2.4 2012-01-11 20:35:57 -05:00
Mike Bayer d78d2d60aa - [bug] Added __reduce__ to StatementError,
DBAPIError so that exceptions are pickleable,
as when using multiprocessing.  However, not
all DBAPIs support this yet, such as
psycopg2. [ticket:2371]
2012-01-10 11:15:11 -05:00
Mike Bayer a4a81f7b96 - [bug] the "name" of an FK constraint in SQLite
is reflected as "None", not "0" [ticket:2364].
SQLite does not appear to support constraint
naming in any case (the names are ignored).
2012-01-07 15:37:51 -05:00
Mike Bayer 8ad65d0ee1 - [bug] Decode incoming values when retrieving
list of index names and the names of columns
within those indexes.  [ticket:2269]
- rewrite unicode reflection test to be of more general use on
broken backends
2011-12-06 16:31:52 -05:00
Mike Bayer df9e3f2fb9 - reflection process always resets the primary key constraint
first, fixes extend_existing
2011-12-04 15:57:08 -05:00
Mike Bayer 632043bc8a - [bug] Fixed bug whereby transaction.rollback()
would throw an error on an invalidated
connection if the transaction were a
two-phase or savepoint transaction.
For plain transactions, rollback() is a no-op
if the connection is invalidated, so while
it wasn't 100% clear if it should be a no-op,
at least now the interface is consistent.
[ticket:2317]
2011-12-04 14:25:00 -05:00
Mike Bayer 81945d7a0c - [feature] The "extend_existing" flag on Table
now allows for the reflection process to take
effect for a Table object that's already been
defined; when autoload=True and extend_existing=True
are both set, the full set of columns will be
reflected from the Table which will then
*overwrite* those columns already present,
rather than no activity occurring.  Columns that
are present directly in the autoload run
will be used as always, however.
[ticket:1410]
2011-12-04 14:16:42 -05:00
Mike Bayer 896bc4c5b6 - [bug] Fixed bug whereby "order_by='foreign_key'"
option to Inspector.get_table_names
wasn't implementing the sort properly, replaced
with the existing sort algorithm
- clean up metadata usage in reflection tests
2011-12-01 14:21:43 -05:00
Mike Bayer 8301651428 - [feature] Added new support for remote "schemas":
- MetaData() accepts "schema" and "quote_schema"
      arguments, which will be applied to the same-named
      arguments of a Table
      or Sequence which leaves these at their default
      of ``None``.
    - Sequence accepts "quote_schema" argument
    - tometadata() for Table will use the "schema"
      of the incoming MetaData for the new Table
      if the schema argument is explicitly "None"
    - Added CreateSchema and DropSchema DDL
      constructs - these accept just the string
      name of a schema and a "quote" flag.
    - When using default "schema" with MetaData,
      ForeignKey will also assume the "default" schema
      when locating remote table.  This allows the "schema"
      argument on MetaData to be applied to any
      set of Table objects that otherwise don't have
      a "schema".
    - a "has_schema" method has been implemented
      on dialect, but only works on Postgresql so far.
    Courtesy Manlio Perillo, [ticket:1679]
2011-10-23 16:57:48 -04:00
Mike Bayer 88cb44ceee some mssql stuff, though unicode is really not working still... 2011-10-16 11:34:48 -04:00
Mike Bayer 0c6f6e2b77 fix this test for oursql 2011-10-15 15:22:21 -04:00
Mike Bayer f1eea63468 - Added an exception catch + warning for the
"return unicode detection" step within connect,
allows databases that crash on NVARCHAR to
continue initializing, assuming no NVARCHAR
type implemented.  [ticket:2299]
2011-10-15 12:10:31 -04:00
Mike Bayer a0cc36c239 - adjust some tests and such to work better with a mysql 5.5 install
- Added mysql_length parameter to Index construct,
    specifies "length" for indexes.  [ticket:2293]
2011-10-11 00:15:43 -04:00
Mike Bayer 36e2b2d875 ensure sa_pool_key isn't passed to connect 2011-09-21 10:26:49 -04:00
Mike Bayer d3c1f245ef - Improvement to multi-param statement logging,
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]
2011-08-22 11:12:36 -04:00
Mike Bayer 9a2edbf3eb - The recreate() method in all pool classes uses
self.__class__ to get at the type of pool
    to produce, in the case of subclassing.  Note
    there's no usual need to subclass pools.
    [ticket:2254]
2011-08-14 11:55:32 -04:00
Mike Bayer 8b505e7c24 - Narrowed the assumption made when reflecting
a foreign-key referenced table with schema in
the current search path; an explicit schema will
be applied to the referenced table only if
it actually matches that of the referencing table,
which also has an explicit schema.   Previously
it was assumed that "current" schema was synonymous
with the full search_path.  [ticket:2249]
2011-08-09 19:45:20 -04:00
Mike Bayer 7bb2adfff9 - Context manager provided by Connection.begin()
will issue rollback() if the commit() fails,
not just if an exception occurs.
2011-07-12 19:34:25 -04:00
Mike Bayer 138774b234 - fix up the invalidate on connect for py3k
- fix the test for separately installed pysqlite
2011-07-06 12:07:36 -04:00
Mike Bayer e936a7b359 - Failures on connect which raise dbapi.Error
will forward the error to dialect.is_disconnect()
and set the "connection_invalidated" flag if
the dialect knows this to be a potentially
"retryable" condition.  Only Oracle ORA-01033
implemented for now.  [ticket:2201]

- Added ORA-01033 to disconnect codes, which
can be caught during a connection
event.  [ticket:2201]
2011-07-01 16:52:11 -04:00
Mike Bayer fc4f7de005 - Fixed bug whereby adaptation of old append_ddl_listener()
function was passing unexpected **kw through
    to the Table event.   Table gets no kws, the MetaData
    event in 0.6 would get "tables=somecollection",
    this behavior is preserved.  [ticket:2206]
2011-06-30 10:27:52 -04:00
Mike Bayer 1006f17051 if python 2.4, have DontWrapException be old style 2011-06-26 19:50:31 -04:00
Mike Bayer e821573a24 - Added mixin class sqlalchemy.ext.DontWrapMixin.
User-defined exceptions of this type are never
wrapped in StatementException when they
occur in the context of a statement
execution.

- StatementException wrapping will display the
original exception class in the message.
2011-06-22 11:45:28 -04:00
Mike Bayer 4d92dc9730 ARG 2011-06-02 21:35:27 -04:00
Mike Bayer 16073ae044 - adjust further for unix-style casing, also this is mysql not just mysqldb 2011-06-02 20:11:47 -04:00
Mike Bayer 9211ecb6cf - Unit tests pass 100% on MySQL installed
on windows, after aggressive exclusion of a wide variety
of tests.   Not clear to what degree the failures are related to
version 5.5 vs. the usage of windows, in particular the ON UPDATE CASCADE
immediately crashes the server.   The features being tested here are all
edge cases not likely to be used in typical MySQL environments.
- Removed the "adjust casing" step that would
fail when reflecting a table on MySQL
on windows with a mixed case name.  After some
experimenting with a windows MySQL server, it's
been determined that this step wasn't really
helping the situation much; MySQL does not return
FK names with proper casing on non-windows
platforms either, and removing the step at
least allows the reflection to act more like
it does on other OSes.   A warning here
has been considered but its difficult to
determine under what conditions such a warning
can be raised, so punted on that for now -
added some docs instead. [ticket:2181]

- supports_sane_rowcount will be set to False
if using MySQLdb and the DBAPI doesn't provide
the constants.CLIENT module.
2011-06-02 19:52:26 -04:00
Mike Bayer fae54b27db - Fixed bug whereby metadata.reflect(bind)
would close a Connection passed as a
    bind argument.  Regression from 0.6.
2011-06-01 17:46:17 -04:00