Commit Graph

457 Commits

Author SHA1 Message Date
Mike Bayer b9657c763a - Fixed bug preventing alias() of an alias() from being
cloned or adapted (occurs frequently in ORM operations).
[ticket:1641]
2009-12-18 18:46:40 +00:00
Mike Bayer 1b1acad676 - multi-part schema names, i.e. with dots such as
"dbo.master", are now rendered in select() labels
with underscores for dots, i.e. "dbo_master_table_column".
This is a "friendly" label that behaves better
in result sets. [ticket:1428]
2009-12-08 02:27:35 +00:00
Mike Bayer 71c0be0921 - The "use get" behavior of many-to-one relations, i.e. that a
lazy load will fallback to the possibly cached query.get()
value, now works across join conditions where the two compared
types are not exactly the same class, but share the same
"affinity" - i.e. Integer and SmallInteger.  Also allows
combinations of reflected and non-reflected types to work
with 0.5 style type reflection, such as PGText/Text (note 0.6
reflects types as their generic versions).   [ticket:1556]
- types now support an "affinity comparison" operation, i.e.
that an Integer/SmallInteger are "compatible", or
a Text/String, PickleType/Binary, etc.  Part of
[ticket:1556].
2009-12-08 01:53:21 +00:00
Mike Bayer 3b0f5d0cfd remove unfinished dialects 2009-12-07 19:29:36 +00:00
Mike Bayer 7dc4df8a68 - The Boolean type, when used on a backend that doesn't
have native boolean support, will generate a CHECK
constraint "col IN (0, 1)" along with the int/smallint-
based column type.  This can be switched off if
desired with create_constraint=False.
Note that MySQL has no native boolean *or* CHECK constraint
support so this feature isn't available on that platform.
[ticket:1589]
2009-12-06 22:58:05 +00:00
Mike Bayer f9cb6f5834 - reworked the DDL generation of ENUM and similar to be more platform agnostic.
Uses a straight CheckConstraint with a generic expression.  Preparing for boolean
constraint in [ticket:1589]
- CheckConstraint now accepts SQL expressions, though support for quoting of values
will be very limited.  we don't want to get into formatting dates and such.
2009-12-06 19:51:10 +00:00
Mike Bayer d9388a5194 - VARCHAR/NVARCHAR will not render without a length, raises
an error before passing to MySQL.   Doesn't impact
CAST since VARCHAR is not allowed in MySQL CAST anyway,
the dialect renders CHAR/NCHAR in those cases.
[ticket:1252]
2009-11-22 22:11:41 +00:00
Mike Bayer 447dc44e1f start relying on new unicode detection fully - remove isinstance() from the unicode result processing. 2009-11-15 19:46:54 +00:00
Mike Bayer 5f6ed1a3f8 - pg8000 + postgresql dialects now check for float/numeric return
types to more intelligently determine float() vs. Decimal(),
[ticket:1567]
- since result processing is a hot issue of late, the DBAPI type
returned from cursor.description is certainly useful in cases like
these to determine an efficient result processor.   There's likely
other result processors that can make use of it.  But, backwards
incompat change to result_processor().  Happy major version number..
2009-11-15 19:20:22 +00:00
Mike Bayer 9911443b9d - new oursql dialect added. [ticket:1613] 2009-11-10 22:39:42 +00:00
Mike Bayer 12a323eb0c test fix, [ticket:1595] 2009-11-10 00:10:11 +00:00
Mike Bayer 6acbb4fb93 - simplify default schema name test
- MySQL + zxjdbc *is* unicode by default.  it was the broken initialize()
2009-11-03 19:48:07 +00:00
Mike Bayer e35dcee6ca - The "start" and "increment" attributes on Sequence now
generate "START WITH" and "INCREMENT BY" by default,
on Oracle and Postgresql.  Firebird doesn't support
these keywords right now.  [ticket:1545]
2009-11-03 18:33:57 +00:00
Mike Bayer 5e0a1d1ea1 no native unicode for mysql + zxjdbc 2009-10-26 18:52:12 +00:00
Mike Bayer 62d2069210 whats up with the native_unicode test on jython 2009-10-26 18:23:20 +00:00
Mike Bayer bc714d614d test fixes 2009-10-26 01:29:56 +00:00
Mike Bayer 5119ce78b5 - The psycopg2 dialect now uses psycopg2's "unicode extension"
on all new connections, which allows all String/Text/etc.
types to skip the need to post-process bytestrings into
unicode (an expensive step due to its volume).  Other
dialects which return unicode natively (pg8000, zxjdbc)
also skip unicode post-processing.

- String/Text/Unicode types now skip the unicode() check
on each result column value if the dialect has
detected the DBAPI as returning Python unicode objects
natively.  This check is issued on first connect
using "SELECT CAST 'some text' AS VARCHAR(10)" or
equivalent, then checking if the returned object
is a Python unicode.   This allows vast performance
increases for native-unicode DBAPIs, including
pysqlite/sqlite3, psycopg2, and pg8000.
2009-10-26 00:32:39 +00:00
Mike Bayer eb9763febe - generalized Enum to issue a CHECK constraint + VARCHAR on default platform
- added native_enum=False flag to do the same on MySQL, PG, if desired
2009-10-25 21:27:08 +00:00
Mike Bayer 52b1ace676 - ResultProxy internals have been overhauled to greatly reduce
method call counts when fetching columns that have no
type-level processing applied.   Provides a 100% speed
improvement when fetching large result sets with no unicode
conversion.  Many thanks to Elixir's Gaëtan de Menten
for this dramatic improvement !  [ticket:1586]
2009-10-24 16:38:07 +00:00
Mike Bayer a43a0e8b68 - insert() and update() constructs can now embed bindparam()
objects using names that match the keys of columns.  These
      bind parameters will circumvent the usual route to those
      keys showing up in the VALUES or SET clause of the generated
      SQL. [ticket:1579]
2009-10-23 01:08:02 +00:00
Mike Bayer e552ce339e - RETURNING is supported by 8.2+
- add docs for PG delete..returning
2009-10-21 16:33:04 +00:00
Mike Bayer 404f43894a merge r6418 from 0.5, dedupe expressions on clause ident, not string value
[ticket:1574]
2009-10-20 17:12:58 +00:00
Mike Bayer 7b457b9731 merged r6416 of 0.5 branch, fix the "numeric" paramstyle and add tests 2009-10-20 16:19:54 +00:00
Mike Bayer eb6f1f87f6 deprecations per [ticket:1498]:
- deprecated PassiveDefault - use DefaultClause.
- the BINARY and MSBinary types now generate "BINARY" in all
cases.  Omitting the "length" parameter will generate
"BINARY" with no length.  Use BLOB to generate an unlengthed
binary column.
- the "quoting='quoted'" argument to MSEnum/ENUM is deprecated.
It's best to rely upon the automatic quoting.
- "shortname" attribute on bindparam() is removed.
- fold_equivalents flag on join is deprecated (will remain
until [ticket:1131] is implemented)
- "scalar" flag on select() is removed, use
select.as_scalar().
- 'transactional' flag on sessionmaker() and others is
removed. Use 'autocommit=True' to indicate 'transactional=False'.
- 'polymorphic_fetch' argument on mapper() is removed.
Loading can be controlled using the 'with_polymorphic'
option.
- 'select_table' argument on mapper() is removed.  Use
'with_polymorphic=("*", <some selectable>)' for this
functionality.
- 'proxy' argument on synonym() is removed.  This flag
did nothing throughout 0.5, as the "proxy generation"
behavior is now automatic.
- Passing a single list of elements to eagerload(),
eagerload_all(), contains_eager(), lazyload(),
defer(), and undefer() instead of multiple positional
-args is deprecated.
- Passing a single list of elements to query.order_by(),
query.group_by(), query.join(), or query.outerjoin()
instead of multiple positional *args is deprecated.
- query.iterate_instances() is removed.  Use query.instances().
- Query.query_from_parent() is removed.  Use the
sqlalchemy.orm.with_parent() function to produce a
"parent" clause, or alternatively query.with_parent().
- query._from_self() is removed, use query.from_self()
instead.
- the "comparator" argument to composite() is removed.
Use "comparator_factory".
- RelationProperty._get_join() is removed.
- the 'echo_uow' flag on Session is removed.  Use
logging on the "sqlalchemy.orm.unitofwork" name.
- session.clear() is removed.  use session.expunge_all().
- session.save(), session.update(), session.save_or_update()
are removed.  Use session.add() and session.add_all().
- the "objects" flag on session.flush() remains deprecated.
- the "dont_load=True" flag on session.merge() is deprecated
in favor of "load=False".
- passing an InstanceState (internal SQLAlchemy state object) to
attributes.init_collection() or attributes.get_history() is
deprecated.  These functions are public API and normally
expect a regular mapped object instance.
- the 'engine' parameter to declarative_base() is removed.
Use the 'bind' keyword argument.
2009-10-15 23:00:06 +00:00
Mike Bayer c5571ab19a - an executemany() now requires that all bound parameter
sets require that all keys are present which are
present in the first bound parameter set.  The structure
and behavior of an insert/update statement is very much
determined by the first parameter set, including which
defaults are going to fire off, and a minimum of
guesswork is performed with all the rest so that performance
is not impacted.  For this reason defaults would otherwise
silently "fail" for missing parameters, so this is now guarded
against. [ticket:1566]
2009-10-15 18:41:02 +00:00
Mike Bayer bc351a2dc4 - DefaultRunner and subclasses have been removed. The job
of this object has been simplified and moved into
ExecutionContext.  Dialects which support sequences should
add a `fire_sequence()` method to their execution context
implementation.  [ticket:1566]
2009-10-15 16:09:59 +00:00
Mike Bayer 114ad36894 - RowProxy objects are now pickleable, i.e. the object returned
by result.fetchone(), result.fetchall() etc.
- the "named tuple" objects returned when iterating a
Query() are now pickleable.
2009-10-11 17:16:53 +00:00
Mike Bayer 9bab004a9b - unit test fixes
- py3k readme
- removed column.sequence accessor
2009-10-10 16:14:13 +00:00
Philip Jenvey 5a9c1b8824 merge from branches/clauseelement-nonzero
adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash
collisions (which only occur on Jython)
fixes #1547
2009-09-24 02:11:56 +00:00
Philip Jenvey f385260987 mssql+zxjdbc support
original patch from Victor Ng
fixes #1505
2009-09-11 08:10:32 +00:00
Philip Jenvey 2c4311c2a9 fix the new Binary str handling under Jython 2009-09-09 06:48:06 +00:00
Mike Bayer 0b292e8842 - the Binary type now returns data as a Python string
(or a "bytes" type in Python 3), instead of the built-
in "buffer" type.  This allows symmetric round trips
of binary data. [ticket:1524]
2009-09-05 03:29:20 +00:00
Philip Jenvey 8e551942c0 this workaround isn't necessary 2009-08-18 05:51:32 +00:00
Philip Jenvey fc59a5e0c4 oracle+zxjdbc returning support 2009-08-18 05:28:05 +00:00
Mike Bayer d564baf593 - the Oracle dialect now features NUMBER which intends
to act justlike Oracle's NUMBER type.  It is the primary
numeric type returned by table reflection and attempts
to return Decimal()/float/int based on the precision/scale
parameters.  [ticket:885]
2009-08-09 23:46:06 +00:00
Mike Bayer f0d2e599b6 - PG: somewhat better support for % signs in table/column names;
psycopg2 can't handle a bind parameter name of
%(foobar)s however and SQLA doesn't want to add overhead
just to treat that one non-existent use case.
[ticket:1279]
- MySQL: somewhat better support for % signs in table/column names;
MySQLdb can't handle % signs in SQL when executemany() is used,
and SQLA doesn't want to add overhead just to treat that one
non-existent use case. [ticket:1279]
2009-08-09 22:11:40 +00:00
Philip Jenvey a53d4e2ab4 o oracle+zxjdbc type handling additions
o avoid returning tests on oracle+zxjdbc for now
2009-08-09 00:56:52 +00:00
Mike Bayer a7499ddfc0 fix up oracle tests, returning is on by default 2009-08-08 16:49:28 +00:00
Philip Jenvey b365cc8396 ensure order of larger comparisons 2009-08-08 02:01:46 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Mike Bayer b303eb9342 merged [ticket:1486] fix from 0.6 2009-07-28 17:47:54 +00:00
Mike Bayer 4d036d6dd4 - Unary expressions such as DISTINCT propagate their
type handling to result sets, allowing conversions like
unicode and such to take place.  [ticket:1420]
2009-07-25 19:34:02 +00:00
Mike Bayer 8804e1963f - Fixed a bug in extract() introduced in 0.5.4 whereby
the string "field" argument was getting treated as a
ClauseElement, causing various errors within more
complex SQL transformations.
2009-07-17 15:10:54 +00:00
Mike Bayer 5503028d8c changed reference to PostgreSQL in docs. 2009-07-13 02:04:54 +00:00
Mike Bayer 45cec095b4 - unit tests have been migrated from unittest to nose.
See README.unittests for information on how to run
the tests.  [ticket:970]
2009-06-10 21:18:24 +00:00
Mike Bayer 5ea1d67315 - sql
- Removed an obscure feature of execute() (including connection,
      engine, Session) whereby a bindparam() construct can be sent as
      a key to the params dictionary.  This usage is undocumented
      and is at the core of an issue whereby the bindparam() object
      created implicitly by a text() construct may have the same
      hash value as a string placed in the params dictionary and
      may result in an inappropriate match when computing the final
      bind parameters.   Internal checks for this condition would
      add significant latency to the critical task of parameter
      rendering, so the behavior is removed.  This is a backwards
      incompatible change for any application that may have been
      using this feature, however the feature has never been
      documented.
2009-05-29 18:56:50 +00:00
Jason Kirtland aca84bebb0 extract() is now dialect-sensitive and supports SQLite and others. 2009-03-30 20:41:48 +00:00
Mike Bayer 1ad157a0a1 remove needless print stuff 2009-03-30 15:38:00 +00:00
Mike Bayer d0f67e2c4d - Lazy loader will not use get() if the "lazy load"
SQL clause matches the clause used by get(), but
contains some parameters hardcoded.  Previously
the lazy strategy would fail with the get().  Ideally
get() would be used with the hardcoded parameters
but this would require further development.
[ticket:1357]
2009-03-29 21:21:10 +00:00
Mike Bayer 0983b610b4 - An alias() of a select() will convert to a "scalar subquery"
when used in an unambiguously scalar context, i.e. it's used
in a comparison operation.  This applies to
the ORM when using query.subquery() as well.
2009-03-21 16:12:37 +00:00