summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
Commit message (Collapse)AuthorAgeFilesLines
* - happy new yearMike Bayer2016-01-2910-10/+10
|
* - reinstate "dont set up integer index in keymap if we're on cexts",Mike Bayer2016-01-271-5/+10
| | | | | and this time also fix the cext itself to properly handle int vs. long on py2k
* Revert "- dont set up integer index in keymap if we're on cexts"Mike Bayer2016-01-271-10/+5
| | | | | | This reverts commit de0d144a395c31eb74084177df95a4858b830f88. Apparently the test suite is not using the cextensions correctly at the moment.
* - dont set up integer index in keymap if we're on cextsMike Bayer2016-01-271-5/+10
|
* - calling str() on a core sql construct has been made more "friendly",Mike Bayer2016-01-191-0/+17
| | | | | | | | | | when the construct contains non-standard sql elements such as returning, array index operations, or dialect-specific or custom datatypes. a string is now returned in these cases rendering an approximation of the construct (typically the postgresql-style version of it) rather than raising an error. fixes #3631 - add within_group to top-level imports - add eq_ignore_whitespace to sqlalchemy.testing imports
* - A deep improvement to the recently added :meth:`.TextClause.columns`Mike Bayer2016-01-142-133/+275
| | | | | | | | | | | | | | | | | | | method, and its interaction with result-row processing, now allows the columns passed to the method to be positionally matched with the result columns in the statement, rather than matching on name alone. The advantage to this includes that when linking a textual SQL statement to an ORM or Core table model, no system of labeling or de-duping of common column names needs to occur, which also means there's no need to worry about how label names match to ORM columns and so-forth. In addition, the :class:`.ResultProxy` has been further enhanced to map column and string keys to a row with greater precision in some cases. fixes #3501 - reorganize the initialization of ResultMetaData for readability and complexity; use the name "cursor_description", define the task of "merging" cursor_description with compiled column information as its own function, and also define "name extraction" as a separate task. - fully change the name we use in the "ambiguous column" error to be the actual name that was ambiguous, modify the C ext also
* - reorganize schema_translate_map to be succinct and gain the performanceMike Bayer2016-01-115-25/+52
| | | | back by using an attrgetter for the default case
* - ensure we use a Connection for effective schema here since Engine doesn'tMike Bayer2016-01-092-1/+3
| | | | have it; keep it simple
* - Multi-tenancy schema translation for :class:`.Table` objects is added.Mike Bayer2016-01-084-5/+51
| | | | | | | | | This supports the use case of an application that uses the same set of :class:`.Table` objects in many schemas, such as schema-per-user. A new execution option :paramref:`.Connection.execution_options.schema_translate_map` is added. fixes #2685 - latest tox doesn't like the {posargs} in the profile rerunner
* - Added a new entrypoint system to the engine to allow "plugins" toMike Bayer2016-01-064-2/+123
| | | | | | | | | | | be stated in the query string for a URL. Custom plugins can be written which will be given the chance up front to alter and/or consume the engine's URL and keyword arguments, and then at engine create time will be given the engine itself to allow additional modifications or event registration. Plugins are written as a subclass of :class:`.CreateEnginePlugin`; see that class for details. fixes #3536
* - Fixed 1.0 regression where the eager fetch of cursor.rowcount wasMike Bayer2016-01-052-1/+4
| | | | | | | | no longer called for an UPDATE or DELETE statement emitted via plain text or via the :func:`.text` construct, affecting those drivers that erase cursor.rowcount once the cursor is closed such as SQL Server ODBC and Firebird drivers. fixes #3622
* Change generator termination from StopIteration to return.pr/211pgjones2015-10-301-1/+1
| | | | | | | | | | | From [PEP 479](https://www.python.org/dev/peps/pep-0479/) the correct way to terminate a generator is to return (which implicitly raises StopIteration) rather than raise StopIteration. Without this change using sqlalchemy in python 3.5 or greater results in these warnings PendingDeprecationWarning: generator '__iter__' raised StopIteration which this commit should remove.
* Add a lot more detailEric Siegerman2015-09-231-3/+22
| | | | (cherry picked from commit 5db5e18d3babdb3ee857c075c774a585505b78ce)
* Add some markupEric Siegerman2015-09-231-2/+2
| | | | (cherry picked from commit 81eefe038ea44a5314002483dde9cf00580df1bd)
* A few minor rewordingsEric Siegerman2015-09-231-3/+3
| | | | (cherry picked from commit ea084bdc656a6a64db1ee582630d415bc8154505)
* - Fixed regression where new methods on :class:`.ResultProxy` usedMike Bayer2015-07-191-2/+12
| | | | | | | | | by the ORM :class:`.Query` object (part of the performance enhancements of :ticket:`3175`) would not raise the "this result does not return rows" exception in the case where the driver (typically MySQL) fails to generate cursor.description correctly; an AttributeError against NoneType would be raised instead. fixes #3481
* - Fixed regression where :meth:`.ResultProxy.keys` would returnMike Bayer2015-07-191-3/+6
| | | | | | | | un-adjusted internal symbol names for "anonymous" labels, which are the "foo_1" types of labels we see generated for SQL functions without labels and similar. This was a side effect of the performance enhancements implemented as part of references #918. fixes #3483
* Remove RootTransaction<->RootTransaction reference cycleJakub Stasiak2015-07-181-1/+5
| | | | (cherry picked from commit 3ef00e816da042d4932be53b86f76db17c800842)
* add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUEpr/186jakeogh2015-06-271-1/+2
|
* add NO MINVALUE and NO MAXVALUE support to Sequence()jakeogh2015-06-271-1/+2
|
* add MAXVALUE support to Sequence()jakeogh2015-06-271-1/+1
|
* add MINVALUE support to Sequence()jakeogh2015-06-271-2/+2
|
* - more edits, references #3461Mike Bayer2015-06-191-2/+4
|
* - add explciit section on engine disposal, fixes #3461Mike Bayer2015-06-191-14/+10
|
* - add test cases for pullreq github:182, where we add a newMike Bayer2015-06-141-2/+19
| | | | | | | | "max_row_buffer" execution option for BufferedRowResultProxy - also add documentation, changelog and version notes - rework the max_row_buffer argument to be interpreted from the execution options upfront when the BufferedRowResultProxy is first initialized.
* Added max_row_buffer attribute to the context execution options and usepr/182Morgan McClure2015-06-131-2/+7
| | | | it to prevent excess memory usage with yield_per
* BufferedRowResultProxy should stop growing at 100Morgan McClure2015-06-131-4/+1
|
* - Added new engine event :meth:`.ConnectionEvents.engine_disposed`.Mike Bayer2015-06-061-0/+1
| | | | Called after the :meth:`.Engine.dispose` method is called.
* - Fixed bug where known boolean values used byMike Bayer2015-05-262-9/+8
| | | | | | | | :func:`.engine_from_config` were not being parsed correctly; these included ``pool_threadlocal`` and the psycopg2 argument ``use_native_unicode``. fixes #3435 - add legacy_schema_aliasing config parsing for mssql - move use_native_unicode config arg to the psycopg2 dialect
* - fix some tests related to the URL change and try to makeMike Bayer2015-05-232-6/+13
| | | | the URL design a little simpler
* - Adjustments to the engine plugin hook, such that theMike Bayer2015-05-222-9/+12
| | | | | | | | :meth:`.URL.get_dialect` method will continue to return the ultimate :class:`.Dialect` object when a dialect plugin is used, without the need for the caller to be aware of the :meth:`.Dialect.get_dialect_cls` method. reference #3379
* - Added support for the case of the misbehaving DBAPI that hasMike Bayer2015-05-153-2/+23
| | | | | | | | | | | pep-249 exception names linked to exception classes of an entirely different name, preventing SQLAlchemy's own exception wrapping from wrapping the error appropriately. The SQLAlchemy dialect in use needs to implement a new accessor :attr:`.DefaultDialect.dbapi_exception_translation_map` to support this feature; this is implemented now for the py-postgresql dialect. fixes #3421
* - New features added to support engine/pool plugins with advancedMike Bayer2015-04-303-3/+76
| | | | | | | | | | | | | | | | | | | | | | | | | functionality. Added a new "soft invalidate" feature to the connection pool at the level of the checked out connection wrapper as well as the :class:`._ConnectionRecord`. This works similarly to a modern pool invalidation in that connections aren't actively closed, but are recycled only on next checkout; this is essentially a per-connection version of that feature. A new event :class:`.PoolEvents.soft_invalidate` is added to complement it. fixes #3379 - Added new flag :attr:`.ExceptionContext.invalidate_pool_on_disconnect`. Allows an error handler within :meth:`.ConnectionEvents.handle_error` to maintain a "disconnect" condition, but to handle calling invalidate on individual connections in a specific manner within the event. - Added new event :class:`.DialectEvents.do_connect`, which allows interception / replacement of when the :meth:`.Dialect.connect` hook is called to create a DBAPI connection. Also added dialect plugin hooks :meth:`.Dialect.get_dialect_cls` and :meth:`.Dialect.engine_created` which allow external plugins to add events to existing dialects using entry points. fixes #3355
* - Fixed a regression where the "last inserted id" mechanics wouldMike Bayer2015-04-081-12/+20
| | | | | | fail to store the correct value for MSSQL on an INSERT where the primary key value was present in the insert params before execution. fixes #3360
* - The "auto close" for :class:`.ResultProxy` is now a "soft" close.Mike Bayer2015-03-173-40/+143
| | | | | | | | | | | That is, after exhausing all rows using the fetch methods, the DBAPI cursor is released as before and the object may be safely discarded, but the fetch methods may continue to be called for which they will return an end-of-result object (None for fetchone, empty list for fetchmany and fetchall). Only if :meth:`.ResultProxy.close` is called explicitly will these methods raise the "result is closed" error. fixes #3330 fixes #3329
* - copyright 2015Mike Bayer2015-03-1010-10/+10
|
* - fix a potential race condition where the per-mapper LRUCache used byMike Bayer2015-03-091-3/+2
| | | | | | | | | | | | | persistence.py could theoretically hit the limit of the cache (100 items by default) and at some points fail to have a key that we check for, due to the cleanup. This has never been observed so its likely that so far, the total number of INSERT, UPDATE and DELETE statement structures in real apps has not exceeded 100 on a per-mapper basis; this could happen for apps that run a very wide variety of attribute modified combinations into the unit of work, *and* which have very high concurrency going on. This change will be a lot more significant when we open up use of LRUCache + compiled cache with the baked query extension.
* fooMike Bayer2015-03-082-20/+31
|
* - the change for #918 was of course not nearly that simple.Mike Bayer2015-03-071-1/+1
| | | | | | | | | | | | | | | | | | The "wrapping" employed by the mssql and oracle dialects using the "iswrapper" argument was not being used intelligently by the compiler, and the result map was being written incorrectly, using *more* columns in the result map than were actually returned by the statement, due to "row number" columns that are inside the subquery. The compiler now writes out result map on the "top level" select in all cases fully, and for the mssql/oracle wrapping case extracts out the "proxied" columns in a second step, which only includes those columns that are proxied outwards to the top level. This change might have implications for 3rd party dialects that might be imitating oracle's approach. They can safely continue to use the "iswrapper" kw which is now ignored, but they may need to also add the _select_wraps argument as well.
* - The SQL compiler now generates the mapping of expected columnspositional_targetingMike Bayer2015-03-072-76/+139
| | | | | | | | | | | | | | | | | such that they are matched to the received result set positionally, rather than by name. Originally, this was seen as a way to handle cases where we had columns returned with difficult-to-predict names, though in modern use that issue has been overcome by anonymous labeling. In this version, the approach basically reduces function call count per-result by a few dozen calls, or more for larger sets of result columns. The approach still degrades into a modern version of the old approach if textual elements modify the result map, or if any discrepancy in size exists between the compiled set of columns versus what was received, so there's no issue for partially or fully textual compilation scenarios where these lists might not line up. fixes #918 - callcounts still need to be adjusted down for this so zoomark tests won't pass at the moment
* - Fixed bug in :class:`.Connection` and pool where theMike Bayer2015-02-041-0/+7
| | | | | | | | | :meth:`.Connection.invalidate` method, or an invalidation due to a database disconnect, would fail if the ``isolation_level`` parameter had been used with :meth:`.Connection.execution_options`; the "finalizer" that resets the isolation level would be called on the no longer opened connection. fixes #3302
* - A warning is emitted if the ``isolation_level`` parameter is usedMike Bayer2015-02-043-0/+22
| | | | | | | | | | | | | | | | with :meth:`.Connection.execution_options` when a :class:`.Transaction` is in play; DBAPIs and/or SQLAlchemy dialects such as psycopg2, MySQLdb may implicitly rollback or commit the transaction, or not change the setting til next transaction, so this is never safe. - Added new parameter :paramref:`.Session.connection.execution_options` which may be used to set up execution options on a :class:`.Connection` when it is first checked out, before the transaction has begun. This is used to set up options such as isolation level on the connection before the transaction starts. - added new documentation section detailing best practices for setting transaction isolation with sessions. fixes #3296
* - remove the clever approach w/ dialect events, and remove the needMike Bayer2015-01-251-17/+20
| | | | | | for a for-loop through an empty tuple. we add one more local flag to handle the logic without repetition of dialect.do_execute() calls.
* - remove context-specific post-crud logic from Connection and inline post-crudMike Bayer2015-01-252-75/+81
| | | | | | | | | | logic to some degree in DefaultExecutionContext. In particular we are removing post_insert() which doesn't appear to be used based on a survey of prominent third party dialects. Callcounts aren't added to existing execute profiling tests and inserts might be a little better. - simplify the execution_options join in DEC. Callcounts don't appear affected.
* - Added new user-space accessors for viewing transaction isolationMike Bayer2015-01-203-15/+186
| | | | | | | | | levels; :meth:`.Connection.get_isolation_level`, :attr:`.Connection.default_isolation_level`. - enhance documentation inter-linkage between new accessors, existing isolation_level parameters, as well as in the dialect-level methods which should be fully covered by Engine/Connection level APIs now.
* - The multi-values version of :meth:`.Insert.values` has beenMike Bayer2015-01-131-4/+5
| | | | | | | | | | | | repaired to work more usefully with tables that have Python- side default values and/or functions, as well as server-side defaults. The feature will now work with a dialect that uses "positional" parameters; a Python callable will also be invoked individually for each row just as is the case with an "executemany" style invocation; a server- side default column will no longer implicitly receive the value explicitly specified for the first row, instead refusing to invoke without an explicit value. fixes #3288
* - restate sort_tables in terms of a more fine grainedMike Bayer2015-01-011-1/+68
| | | | | | | | | | | | | sort_tables_and_constraints function. - The DDL generation system of :meth:`.MetaData.create_all` and :meth:`.Metadata.drop_all` has been enhanced to in most cases automatically handle the case of mutually dependent foreign key constraints; the need for the :paramref:`.ForeignKeyConstraint.use_alter` flag is greatly reduced. The system also works for constraints which aren't given a name up front; only in the case of DROP is a name required for at least one of the constraints involved in the cycle. fixes #3282
* correctionsMike Bayer2014-12-272-1/+2
|
* - keep working on fixing #3266, more cases, more testsMike Bayer2014-12-101-4/+5
|
* - identify another spot where _handle_dbapi_error() needs to do somethingMike Bayer2014-12-081-3/+4
| | | | | differently for the case where it is called in an already-invalidated state; don't call upon self.connection