summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/default.py
Commit message (Collapse)AuthorAgeFilesLines
* An overhaul of expression handling for special symbols particularlyMike Bayer2013-10-231-1/+3
| | | | | | | | | | with conjunctions, e.g. ``None`` :func:`.expression.null` :func:`.expression.true` :func:`.expression.false`, including consistency in rendering NULL in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_` expressions which contain boolean constants, and rendering of boolean constants and expressions as compared to "1" or "0" for backends that don't feature ``true``/``false`` constants. [ticket:2804]
* - The method signature of :meth:`.Dialect.reflecttable`, which inMike Bayer2013-10-111-2/+1
| | | | | | | all known cases is provided by :class:`.DefaultDialect`, has been tightened to expect ``include_columns`` and ``exclude_columns`` arguments without any kw option, reducing ambiguity - previously ``exclude_columns`` was missing. [ticket:2748]
* - A rework to the way that "quoted" identifiers are handled, in thatMike Bayer2013-08-271-0/+2
| | | | | | | | | | | | | | | | 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]
* - The ``version_id_generator`` parameter of ``Mapper`` can now be specifiedMike Bayer2013-08-251-0/+7
| | | | | | | | | | | | | | | | | | | | | to rely upon server generated version identifiers, using triggers or other database-provided versioning features, by passing the value ``False``. The ORM will use RETURNING when available to immediately load the new version identifier, else it will emit a second SELECT. [ticket:2793] - The ``eager_defaults`` flag of :class:`.Mapper` will now allow the newly generated default values to be fetched using an inline RETURNING clause, rather than a second SELECT statement, for backends that support RETURNING. - Added a new variant to :meth:`.ValuesBase.returning` called :meth:`.ValuesBase.return_defaults`; this allows arbitrary columns to be added to the RETURNING clause of the statement without interfering with the compilers usual "implicit returning" feature, which is used to efficiently fetch newly generated primary key values. For supporting backends, a dictionary of all fetched values is present at :attr:`.ResultProxy.returned_defaults`. - add a glossary entry for RETURNING - add documentation for version id generation, [ticket:867]
* - A large refactoring of the ``sqlalchemy.sql`` package has reorganizedMike Bayer2013-08-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* a missing cursor.close() here caused a *huge* amount of weird locking ↵Mike Bayer2013-08-021-7/+10
| | | | | | | | issues with pypy, what is strange is how it only occurred in some very specific places under very particular conditions, perhaps it has to do with whether or not this cursor gets gc'ed or not.
* - assorted fixes raised by pypy 2.1beta2, but all of which are goodMike Bayer2013-08-011-0/+24
| | | | | | | | | | | | | | | ideas in general: - pypy2.1 w/ sqlite3 is the first DBAPI we're seeing returning unicode in cursor.description without being py3k. add a new on-connect check for this, if we get back a u"", just don't do description decoding, should be OK for now. - the set tests in test_collection were assuming the two sets would be ordered the same when it tested pop(), can't really assume that. - test_serializer gets worse and worse, pickle is just not really viable here, ding out pypy - pypy2.1b2 seems to allow cursor.lastrowid to work (or we changed something?) - pool._threadconns.current() is a weakref, it can be None - another one of those logging.handlers imports
* - refactor pool a bit so that intent between ↵Mike Bayer2013-07-021-0/+19
| | | | | | | | | | | | | | ConnectionRecord/ConnectionFairy is clear; make sure that the DBAPI connection passed to the reset-on-return events/dialect hooks is also a "fairy", so that dictionaries like "info" are available. [ticket:2770] - rework the execution_options system so that the dialect is given the job of making any immediate adjustments based on a set event. move the "isolation level" logic to use this new system. Also work things out so that even engine-level execution options can be used for things like isolation level; the dialect attaches a connect-event handler in this case to handle the task. - to support this new system as well as further extensibiltiy of execution options add events engine_connect(), set_connection_execution_options(), set_engine_execution_options()
* Merge branch 'ticket_2587'Mike Bayer2013-06-041-0/+5
|\ | | | | | | | | | | Conflicts: test/profiles.txt test/sql/test_selectable.py
| * - add a flag to DefaultDialect for this so that people will have someMike Bayer2013-06-041-0/+3
| | | | | | | | workaround
| * working through tests....Mike Bayer2013-06-021-0/+2
| |
* | Merge branch 'master' into ticket_1068Mike Bayer2013-06-031-30/+25
|\ \ | |/
| * a pass where we try to squash down as many list()/keys() combinationsMike Bayer2013-05-261-1/+1
| | | | | | | | as possible
| * - OK we have -w sql passing for: sqlite, postgresql, oursql 2.7 + 3.3, ↵Mike Bayer2013-05-041-1/+1
| | | | | | | | mysqldb 2.7
| * plugging awayMike Bayer2013-04-271-30/+23
| |
| * - the raw 2to3 runMike Bayer2013-04-271-29/+31
| | | | | | | | - went through examples/ and cleaned out excess list() calls
* | attempt number one, doesn't detect though if the label in the order by is ↵Mike Bayer2013-05-271-0/+2
|/ | | | not directly present there.
* Reworked internal exception raises that emitMike Bayer2013-04-181-2/+0
| | | | | | | | | a rollback() before re-raising, so that the stack trace is preserved from sys.exc_info() before entering the rollback. This so that the traceback is preserved when using coroutine frameworks which may have switched contexts before the rollback function returns. [ticket:2703]
* - add an event to testing so that other dialects can intercept ↵Mike Bayer2013-03-241-0/+4
| | | | | | "test_needs_autoincrement" - get the assumption of "1" for "first sequence item" to be dialect configured
* Fixed bug whereby a DBAPI that can return "0"Mike Bayer2013-03-231-1/+1
| | | | | for cursor.lastrowid would not function correctly in conjunction with :attr:`.ResultProxy.inserted_primary_key`.
* The cx_oracle dialect will no longer run the bind parameter namesMike Bayer2013-02-081-1/+3
| | | | | | | through ``encode()``, as this is not valid on Python 3, and prevented statements from functioning correctly on Python 3. We now encode only if ``supports_unicode_binds`` is False, which is not the case for cx_oracle when at least version 5 of cx_oracle is used.
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* internally at least refer to multirow as "multivalues", to distinguish betweenMike Bayer2012-12-081-1/+1
| | | | | an INSERT that's used in executemany() as opposed to one which has a VALUES clause with multiple entries.
* compiler: add support for multirow insertsIdan Kamara2012-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | Some databases support this syntax for inserts: INSERT INTO table (id, name) VALUES ('v1', 'v2'), ('v3', 'v4'); which greatly increases INSERT speed. It is now possible to pass a list of lists/tuples/dictionaries as the values param to the Insert construct. We convert it to a flat dictionary so we can continue using bind params. The above query will be converted to: INSERT INTO table (id, name) VALUES (:id, :name), (:id0, :name0); Currently only supported on postgresql, mysql and sqlite.
* - recognize that do_rollback() and do_commit() work with a DBAPI connection,Mike Bayer2012-11-221-16/+7
| | | | | | | | | | | | | | | | | | whereas the other do_rollback_twophase(), savepoint etc. work with :class:`.Connection`. the context on these are different as twophase/savepoint are available at the :class:`.Connection` level, whereas commit/rollback are needed at a lower level as well. Rename the argument to "dbapi_connection" when the conneciton is in fact the DBAPI interface. - start thinking about being able to track "autocommit" vs. "commit", but not sure we have a need for this yet. - have Pool call out to a Dialect for all rollback/commit/close operations now. Pool no longer calls DBAPI methods directly. May use this for a workaround for [ticket:2611] - add a new Pool event reset() to allow the pool's reset of the connection to be intercepted. - remove methods in Informix dialect which appear to be hardcoding some isolation settings on new Transaction only; the isolation API should be implemented for Informix. also removed "flag" for transaction commit/rollback being not available; this should be based on server/DBAPI version and we will need someone with test access in order to help determine how this should work
* just a pep8 pass of lib/sqlalchemy/engine/Diana Clarke2012-11-191-2/+1
|
* improve some autodoc linksMike Bayer2012-10-311-2/+2
|
* The long-deprecated and non-functional ``assert_unicode`` flag onMike Bayer2012-10-251-11/+1
| | | | :func:`.create_engine` as well as :class:`.String` is removed.
* - [feature] Various API tweaks to the "dialect"Mike Bayer2012-10-081-0/+10
| | | | | | | API to better support highly specialized systems such as the Akiban database, including more hooks to allow an execution context to access type processors.
* - add back __engine_options__Mike Bayer2012-10-041-3/+3
| | | | | - break test_insert tests into explicitly get_lastrowid() vs. implicit_returning tests, fix up requirements to split them out
* - don't call get_lastrowid() on explicit returningMike Bayer2012-10-041-0/+1
| | | | | | - don't hardwire "subqueries" requirement in the base, mysql < 4.1 isn't working anyway - don't need explicit FB/PG exclusions in test_returning - hit db.connect() for the returning requirement
* small tweaks to make insert() behavior more consistent, mostly tests, ↵Mike Bayer2012-08-231-1/+1
| | | | [ticket:2461]
* - [feature] The before_cursor_execute eventMike Bayer2012-08-231-1/+1
| | | | | | | | | fires off for so-called "_cursor_execute" events, which are usually special-case executions of primary-key bound sequences and default-generation SQL phrases that invoke separately when RETURNING is not used with INSERT. [ticket:2459]
* - break out engine/base.py into base, interfaces, result, util.Mike Bayer2012-08-071-4/+4
| | | | - remove deprecated 0.7 engine methods
* more import cleanupsMike Bayer2012-08-071-4/+5
|
* - [feature] Connection event listeners canMike Bayer2012-07-181-18/+35
| | | | | | now be associated with individual Connection objects, not just Engine objects. [ticket:2511]
* - a big renaming of all the _Underscore classes to haveMike Bayer2012-07-171-21/+21
| | | | | | plain names. The old names are still defined for backwards compatibility. - _BindParamClause renamed to BindParameter
* - [bug] The ResultProxy methods inserted_primary_key,Mike Bayer2012-06-161-0/+2
| | | | | | | | | | | | last_updated_params(), last_inserted_params(), postfetch_cols(), prefetch_cols() all assert that the given statement is a compiled construct, and is an insert() or update() statement as is appropriate, else raise InvalidRequestError. [ticket:2498] - ResultProxy.last_inserted_ids is removed, replaced by inserted_primary_key.
* - [feature] Added SQLite execution optionMike Bayer2012-05-041-4/+4
| | | | | | | "sqlite_raw_colnames=True", will bypass attempts to remove "." from column names returned by SQLite cursor.description. [ticket:2475]
* - [feature] The behavior of column targetingMike Bayer2012-04-241-0/+3
| | | | | | | | | | | | | | in result sets is now case sensitive by default. SQLAlchemy for many years would run a case-insensitive conversion on these values, probably to alleviate early case sensitivity issues with dialects like Oracle and Firebird. These issues have been more cleanly solved in more modern versions so the performance hit of calling lower() on identifiers is removed. The case insensitive comparisons can be re-enabled by setting "case_insensitive=False" on create_engine(). [ticket:2423]
* typos in lib/sqlalchemy/engineDiana Clarke2012-03-171-2/+2
|
* - [feature] Added "no_parameters=True" executionMike Bayer2012-02-131-0/+7
| | | | | | | | | | | | | | | | 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]
* - [bug] A significant change to how labelingMike Bayer2012-02-051-0/+5
| | | | | | | | | | | | | | is applied to columns in SELECT statements allows "truncated" labels, that is label names that are generated in Python which exceed the maximum identifier length (note this is configurable via label_length on create_engine()), to be properly referenced when rendered inside of a subquery, as well as to be present in a result set row using their original in-Python names. [ticket:2396] - apply pep8 to test_labels
* - [feature] New reflection feature "autoload_replace";Mike Bayer2012-01-281-2/+2
| | | | | | | | | | | | | | | 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]
* happy new yearMike Bayer2012-01-041-1/+1
|
* - Added an exception catch + warning for theMike Bayer2011-10-151-13/+18
| | | | | | | "return unicode detection" step within connect, allows databases that crash on NVARCHAR to continue initializing, assuming no NVARCHAR type implemented. [ticket:2299]
* - assume in py3k that description encoding is None unless the dialect reallyMike Bayer2011-04-081-7/+7
| | | | | overrides it - psycopg2 + 3k supports unicode statements...
* - Non-DBAPI errors which occur in the scope of an `execute()`Mike Bayer2011-02-091-1/+1
| | | | | | | | call are now wrapped in sqlalchemy.exc.StatementError, and the text of the SQL statement and repr() of params is included. This makes it easier to identify statement executions which fail before the DBAPI becomes involved. [ticket:2015]
* - add connection and cursor to is_disconnect(). We aren't using it yet,Mike Bayer2011-02-091-1/+1
| | | | | | | | | | | | | | | but we'd like to. Most DBAPIs don't give us anything we can do with it. Some research was done on psycopg2 and it still seems like they give us no adequate method (tried connection.closed, cursor.closed, connection.status). mxodbc claims their .closed attribute will work (but I am skeptical). - remove beahvior in pool that auto-invalidated a connection when the cursor failed to create. That's not the pool's job. we need the conn for the error logic. Can't get any tests to fail, curious why that behavior was there, guess we'll find out (or not). - add support for psycopg2 version detection. even though we have no use for it yet... - adjust one of the reconnect tests to work with oracle's horrendously slow connect speed
* - new dialect for Drizzle [ticket:2003]Mike Bayer2011-01-261-0/+1
| | | | - move mysqldb to a connector, can be shared among mysql/drizzle