Mike Bayer [Fri, 19 Mar 2010 20:59:52 +0000 (16:59 -0400)]
start sketching ideas for a rewritten unit of work.
the basic idea is to bring topological back down to the raw function,
then the whole UOW constructs itself as very fine grained elements with
full dependencies to each other. then a straight execute with a straight sort.
the hope is that the mechanism here would be vastly simpler. while
the presence of a large number of fine-grained records may be expensive
it still is potentially a lot easier to distill into C code, as the
uow's structure now consists of data.
Mike Bayer [Fri, 19 Mar 2010 19:30:48 +0000 (15:30 -0400)]
- join() will now simulate a NATURAL JOIN by default. Meaning,
if the left side is a join, it will attempt to join the right
side to the rightmost side of the left first, and not raise
any exceptions about ambiguous join conditions if successful
even if there are further join targets across the rest of
the left. [ticket:1714]
Mike Bayer [Fri, 19 Mar 2010 17:10:13 +0000 (13:10 -0400)]
- added "lockmode" kw argument to Session.refresh(), will
pass through the string value to Query the same as
in with_lockmode(), will also do version check for a
version_id_col-enabled mapping.
Mike Bayer [Fri, 19 Mar 2010 15:45:42 +0000 (11:45 -0400)]
distinguish between small, large, and many significant digits. the irony
that oracle and sybase are the ones that have the most issues with decimal numbers.
Mike Bayer [Fri, 19 Mar 2010 15:17:14 +0000 (11:17 -0400)]
switching Decimal treatment in MSSQL to be pyodbc specific, added
to connector to share between sybase/mssql. Going
with turning decimals with very low significant digit to floats,
seems to work so far.
Brad Allen [Thu, 18 Mar 2010 20:05:59 +0000 (14:05 -0600)]
Removed MxNumeric and MxFloat because now the sqlalchemy.types base classes support dialects having a class attribute of "supports_native_decimal" indicating native Python Demimal support. Adjusted mssql+mxodbc to use the sqlalchemy.types base classes for Float and Numeric instead of using the base mssql dialect's numeric types.
Brad Allen [Thu, 18 Mar 2010 17:47:45 +0000 (11:47 -0600)]
Hardcoded ident_seed and ident_increment query had bind markers noncompliant with SQL-92, which caused mxODBC failures. This was corrected by using string substitution in building the statement, and removing the bind params.
Mike Bayer [Thu, 18 Mar 2010 15:48:24 +0000 (11:48 -0400)]
- moved most Decimal bind/result handling into types.py, out of sqlite, mysql dialects.
- added an explicit test for [ticket:1216]
- some questions remain about MSSQL - would like to simplify/remove bind handling for numerics
Brad Allen [Wed, 17 Mar 2010 22:27:39 +0000 (16:27 -0600)]
Because of changes to SQLAlchemy bind parameter placement, removed all mxodbc test disabling statements having this pattern: @testing.crashes('mssql+mxodbc', """Invalid bind parameter placement:
Mike Bayer [Wed, 17 Mar 2010 21:48:29 +0000 (17:48 -0400)]
- The official name for the relation() function is now
relationship(), to eliminate confusion over the relational
algebra term. relation() however will remain available
in equal capacity for the foreseeable future. [ticket:1740]
Mike Bayer [Wed, 17 Mar 2010 20:01:29 +0000 (16:01 -0400)]
- pyodbc can do *some* unicode with sybase, python-sybase not at all.
Since python-sybase source code seems to be all from 2001 with no updates,
making pyodbc the default driver.
Mike Bayer [Wed, 17 Mar 2010 19:15:44 +0000 (15:15 -0400)]
- added pyodbc for sybase driver.
- generalized the "freetds" / "unicode statements" behavior of MS-SQL/pyodbc
into the base Pyodbc connector, as this seems to apply to Sybase as well.
- generalized the python-sybase "use autocommit for DDL" into the pyodbc
connector. With pyodbc, the "autocommit" flag on connection is used,
as Pyodbc seems to have more database conversation than python-sybase that
can't otherwise be suppressed.
- Some platforms will now interpret certain literal values
as non-bind parameters, rendered literally into the SQL
statement. This to support strict SQL-92 rules that are
enforced by some platforms including MS-SQL and Sybase.
In this model, bind parameters aren't allowed in the
columns clause of a SELECT, nor are certain ambiguous
expressions like "?=?". When this mode is enabled, the base
compiler will render the binds as inline literals, but only across
strings and numeric values. Other types such as dates
will raise an error, unless the dialect subclass defines
a literal rendering function for those. The bind parameter
must have an embedded literal value already or an error
is raised (i.e. won't work with straight bindparam('x')).
Dialects can also expand upon the areas where binds are not
accepted, such as within argument lists of functions
(which don't work on MS-SQL when native SQL binding is used).
Mike Bayer [Wed, 17 Mar 2010 00:58:46 +0000 (20:58 -0400)]
- mxodbc can use default execute() call
- modified SQLCompiler to support rendering of bind parameters as literal
inline strings for specific sections, if specified by the compiler
subclass, using either literal_binds=True passed to process() or any visit
method, or by setting to False the "binds_in_columns_clause" flag for SQL-92
compatible columns clauses.. The compiler subclass is responsible for
implementing the literal quoting function which should make use of the DBAPI's native
capabilities.
- SQLCompiler now passes **kw to most process() methods (should be all,
ideally) so that literal_binds is propagated.
- added some rudimentary tests for mxodbc.
Brad Allen [Tue, 16 Mar 2010 22:53:21 +0000 (16:53 -0600)]
Fixes to pass numeric tests; now by default, the mxodbc connector natively returns Python Decimal data types from columns of type SQL.NUMERIC or SQL.DECIMAL
Mike Bayer [Tue, 16 Mar 2010 16:58:13 +0000 (12:58 -0400)]
- Fixed bug which caused "row switch" logic, that is an
INSERT and DELETE replaced by an UPDATE, to fail when
version_id_col was in use. [ticket:1692]
- Added "version_id_generator" argument to Mapper, this is a
callable that, given the current value of the "version_id_col",
returns the next version number. Can be used for alternate
versioning schemes such as uuid, timestamps. [ticket:1692]
Mike Bayer [Tue, 16 Mar 2010 16:07:47 +0000 (12:07 -0400)]
- added test for #1737
- the fix from r502f1a4f92d5 broke another rare use case, one-to-one on a PK/FK combo which apparently enables use_get.
fortunate that another test waiting in trac reveals this.
Brad Allen [Tue, 16 Mar 2010 02:34:34 +0000 (20:34 -0600)]
Removed custom do_execute which called cursor.executedirect, after discussion with eGenix and zzzeek. Even though more tests pass with executedirect, it is not appropriate for default usage because it does not issue prepare statements to the db, and it forces Python type binding. The executedirect method should only be called when the API user specifically requests it for special case performance reasons.
Brad Allen [Mon, 15 Mar 2010 17:39:03 +0000 (11:39 -0600)]
using executemany instead of executedirect, which passes more tests than with plain execute. Later we need to define logic to determine when to call the normal execute.
Mike Bayer [Mon, 15 Mar 2010 17:08:31 +0000 (13:08 -0400)]
- The visit_pool() method of Dialect is removed, and replaced with
on_connect(). This method returns a callable which receives
the raw DBAPI connection after each one is created. The callable
is assembled into a first_connect/connect pool listener by the
connection strategy if non-None. Provides a simpler interface
for dialects.
Mike Bayer [Sun, 14 Mar 2010 23:03:24 +0000 (23:03 +0000)]
- many incantations to get the tests to run reasonably
- executemany() for some reason uses some tiny buffer, overriding it
- we need to use the IDENTITY_INSERT thing
Mike Bayer [Sun, 14 Mar 2010 22:04:20 +0000 (22:04 +0000)]
- initial working version of sybase, with modifications to the transactional
model to accomodate Sybase's default mode of "no ddl in transactions".
- identity insert not working yet. it seems the default here might be the
opposite of that of MSSQL.
- reflection will be a full rewrite
- default DBAPI is python-sybase, well documented and nicely DBAPI compliant
except for the bind parameter situation, where we have a straightforward workaround
- full Sybase docs at: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0/title.htm
Mike Bayer [Sun, 14 Mar 2010 01:05:17 +0000 (20:05 -0500)]
- Fixed bug in 0.6-reworked "many-to-one" optimizations
such that a many-to-one that is against a non-primary key
column on the remote table (i.e. foreign key against a
UNIQUE column) will pull the "old" value in from the
database during a change, since if it's in the session
we will need it for proper history/backref accounting,
and we can't pull from the local identity map on a
non-primary key column. [ticket:1737] (test is pending)
Mike Bayer [Sat, 13 Mar 2010 21:12:29 +0000 (16:12 -0500)]
- further checks when running in WITH_UNICODE
- When WITH_UNICODE
mode is used in Python 2.xx, a large and scary warning
is emitted asking that the user seriously consider
the usage of this difficult mode of operation.
[ticket:1670]
Mike Bayer [Sat, 13 Mar 2010 18:53:31 +0000 (13:53 -0500)]
- Added "logging_name" argument to create_engine(), Pool() constructor
as well as "pool_logging_name" argument to create_engine() which
filters down to that of Pool. Issues the given string name
within the "name" field of logging messages instead of the default
hex identifier string. [ticket:1555]
Mike Bayer [Sat, 13 Mar 2010 17:28:50 +0000 (12:28 -0500)]
- query.get() now returns None if queried for an identifier
that is present in the identity map with a different class
than the one requested, i.e. when using polymorphic loading.
[ticket:1727]