Commit Graph

6109 Commits

Author SHA1 Message Date
Mike Bayer 53aab63b6c - remove some remaining sys.modules shenanigans
- The "sqlalchemy.exceptions" alias in sys.modules
has been removed.   Base SQLA exceptions are
available via "from sqlalchemy import exc".
The "exceptions" alias for "exc" remains in
"sqlalchemy" for now, it's just not patched into
sys.modules.
rel_0_7b1
2011-02-12 18:00:45 -05:00
Mike Bayer de9ec22de9 - Added an explicit check for the case that the name
'metadata' is used for a column attribute on a
declarative class. [ticket:2050]
2011-02-12 17:33:15 -05:00
Mike Bayer 6cd59ee663 0.7 will be beta classifier to start 2011-02-12 17:14:34 -05:00
Mike Bayer 8b960257ae weird non-ascii char 2011-02-12 17:09:59 -05:00
Mike Bayer ff1ca08b8f ugh. OK let is_modified accept true/false 2011-02-11 18:24:36 -05:00
Mike Bayer 2a289e915e - fix long lines in test_attributes
- add deprecation warning to get_history() when passed
True or False, convert
- rearrange symbol() so we can get sphinx autodata to work
2011-02-11 17:58:49 -05:00
Mike Bayer ad9b85fa8e - replace all usage of True and False for passive with PASSIVE_NO_INITIALIZE,
PASSIVE_OFF, now expresed as non-boolean symbols
- make "passive" available positionally on all get_history() methods,
call it like that
2011-02-11 15:37:44 -05:00
Mike Bayer d7fda4ae03 - Additional tuning to "many-to-one" relationship
loads during a flush().   A change in version 0.6.6
([ticket:2002]) required that more "unnecessary" m2o
loads during a flush could occur.   Extra loading modes have
been added so that the SQL emitted in this
specific use case is trimmed back, while still
retrieving the information the flush needs in order
to not miss anything.  [ticket:2049]
2011-02-11 14:41:29 -05:00
Mike Bayer 33eae4a140 make it more explicit in tests which dialect we want to use for things 2011-02-11 11:24:54 -05:00
Mike Bayer 09efc11fbc - need to limit the list of oracle fn's that don't get parens to a
fixed list.  window functions need parens
2011-02-11 00:49:28 -05:00
Mike Bayer ed4534ea8a fix sqlite test 2011-02-11 00:24:38 -05:00
Mike Bayer 134a4cb3a6 fix some tests 2011-02-10 23:37:15 -05:00
Mike Bayer 848257f7d2 - The concept of associating a ".bind" directly with a
ClauseElement has been explicitly moved to Executable,
i.e. the mixin that describes ClauseElements which represent
engine-executable constructs.  This change is an improvement
to internal organization and is unlikely to affect any
real-world usage.  [ticket:2048]
2011-02-10 22:27:45 -05:00
Mike Bayer 3cbab1ee1e fix some really egregious long lines 2011-02-10 22:09:26 -05:00
Mike Bayer 020d6ef8f0 - Added over() function, method to FunctionElement
classes, produces the _Over() construct which
in turn generates "window functions", i.e.
"<window function> OVER (PARTITION BY <partition by>,
ORDER BY <order by>)".
[ticket:1844]
2011-02-10 21:57:44 -05:00
Mike Bayer ad8700a556 - oursql dialect accepts the same "ssl" arguments in
create_engine() as that of MySQLdb.  [ticket:2047]
2011-02-10 18:04:54 -05:00
Mike Bayer f367117562 - typo fix [ticket:2017] 2011-02-10 15:24:26 -05:00
Mike Bayer bc52cae455 - mssql VARBINARY emits 'max' for length when no length specified, as is
the case already for VARCHAR, NVARCHAR [ticket:1833]
2011-02-10 15:22:07 -05:00
Mike Bayer e43f85965e - The path given as the location of a sqlite database is now
normalized via os.path.abspath(), so that directory changes
within the process don't affect the ultimate location
of a relative file path.  [ticket:2036]
2011-02-10 15:03:11 -05:00
Mike Bayer 3f9a343d72 - Query.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
  as DISTINCT ON (<expr>). [ticket:1069]
- select.distinct() now accepts column expressions
  as *args, interpreted by the Postgresql dialect
  as DISTINCT ON (<expr>).  Note this was already
  available via passing a list to the `distinct`
  keyword argument to select(). [ticket:1069]
- select.prefix_with() accepts multiple expressions
  (i.e. *expr), 'prefix' keyword argument to select()
  accepts a list or tuple.
- Passing a string to the `distinct` keyword argument
  of `select()` for the purpose of emitting special
  MySQL keywords (DISTINCTROW etc.) is deprecated -
  use `prefix_with()` for this.
- put kw arguments to select() in order
- restore docs for _SelectBase, renamed from _SelectBaseMixin
2011-02-10 14:17:08 -05:00
Mike Bayer a6d54d18c1 formatting fix 2011-02-10 11:43:04 -05:00
Mike Bayer e155b7b864 - An exception is raised in the unusual case that an
append or similar event on a collection occurs after
the parent object has been dereferenced, which
prevents the parent from being marked as "dirty"
in the session.  Will commit as a warning in 0.6.
[ticket:2046]
2011-02-10 11:30:23 -05:00
Mike Bayer 311fa4f876 - py3k fix regarding new exception system
- this test keeps throwing a TNS error on Oracle on the buildbot only, runs locally,
seems to be related to some scaling/memory type of issue on the bot
2011-02-09 19:18:33 -05:00
Mike Bayer 7e8f351097 - Non-DBAPI errors which occur in the scope of an execute()
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]
2011-02-09 18:11:40 -05:00
Mike Bayer e80eac22a8 - figured out the ::autodata directive, can move the docstring for
expression.func into the .py module
- added a note about logging only being checked on new connections,
as one user had this issue awhile back, and I suspect it for
a current ML user issue
2011-02-09 16:30:49 -05:00
Mike Bayer 3f30fb065c - The compiler extension now supports overriding the default
compilation of expression._BindParamClause including that
the auto-generated binds within the VALUES/SET clause
of an insert()/update() statement will also use the new
compilation rules. [ticket:2042]
2011-02-09 15:45:15 -05:00
Mike Bayer 34f26ee255 - Fixed bug where a column with a SQL or server side default
that was excluded from a mapping with include_properties
or exclude_properties would result in UnmappedColumnError.
[ticket:1995]
2011-02-09 15:14:54 -05:00
Mike Bayer 6f16b8db6f - add connection and cursor to is_disconnect(). We aren't using it yet,
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
2011-02-09 15:06:32 -05:00
Mike Bayer f473398f01 - Added an additional libpq message to the list of "disconnect"
exceptions, "could not receive data from server"
[ticket:2044]
2011-02-09 10:58:16 -05:00
Mike Bayer 8f381f202e - Adjusted flush accounting step to occur before
the commit in the case of autocommit=True.  This allows
autocommit=True to work appropriately with
expire_on_commit=True, and also allows post-flush session
hooks to operate in the same transactional context
as when autocommit=False.  [ticket:2041]
2011-02-07 16:12:24 -05:00
Mike Bayer ae5b58d9a5 - Session constructor emits a warning when autoflush=True
or expire_on_commit=True when autocommit=True.
[ticket:2041]
2011-02-07 13:30:27 -05:00
Mike Bayer f14f71581c show sequence members 2011-02-05 16:51:24 -05:00
Mike Bayer cf428767dd typo 2011-02-05 16:50:52 -05:00
Mike Bayer a43b106aa7 - Session weak_instance_dict=False is deprecated.
[ticket:1473]
2011-02-05 16:48:17 -05:00
Mike Bayer 5baeabb0c4 - use proper directive here 2011-02-05 16:10:14 -05:00
Mike Bayer 85084caeff - A single contains_eager() call across
multiple entities will indicate all collections
along that path should load, instead of requiring
distinct contains_eager() calls for each endpoint
(which was never correctly documented).
[ticket:2032]

- The "name" field used in orm.aliased() now renders
in the resulting SQL statement.
2011-02-05 16:09:49 -05:00
Mike Bayer 637fdd3251 - apply optimizations to alternate row proxies, [ticket:1787]
- add check to fetchmany() for None, don't send argument if not present,
helps DBAPIs which don't accept "None" for default (ie. pysqlite, maybe others)
- add tests to test_execute to provide 100% coverage for the three alternate
result proxy classes
2011-02-04 18:33:49 -05:00
Mike Bayer d5cc2f83c1 - When explicit sequence execution derives the name
of the auto-generated sequence of a SERIAL column,
which currently only occurs if implicit_returning=False,
now accommodates if the table + column name is greater
than 63 characters using the same logic Postgresql uses.
[ticket:1083]
2011-02-04 17:37:36 -05:00
Mike Bayer 4f1274fc1f - Also emits the correct WHERE criterion
when using single table inheritance. [ticket:2038]
2011-02-02 19:03:20 -05:00
Mike Bayer c5b4938a9a - Fixed bug where "middle" class in a polymorphic hierarchy
would have no 'polymorphic_on' column if it didn't also
specify a 'polymorphic_identity', leading to strange
errors upon refresh, wrong class loaded when querying
from that target. [ticket:2038]
2011-02-02 18:10:07 -05:00
Mike Bayer 5a2c332f5e - Some adjustments so that Interbase is supported as well.
FB/Interbase version idents are parsed into a structure
such as (8, 1, 1, 'interbase') or (2, 1, 588, 'firebird')
so they can be distinguished. [ticket:1885]
- fixed relfection of the "autoincrement" flag against a default
placed on the column.
2011-02-01 16:34:37 -05:00
Mike Bayer 7fcbd39118 docuemnt args for before_parent_attach, after_parent_attach 2011-02-01 15:09:28 -05:00
Mike Bayer 54cc2aa18c - schema.copy() functions will copy dispatch, but only for those events
added with propagate=True.   needs tests
- oracle/fb test schema uses event w/ propagate=True to apply
Sequence to primary key columns with test_needs_autoincrement.
this does actually test the propagate=True flag a bit since it's
needed in the declarative mixin tests where the 'id' column
is copied.
2011-02-01 09:26:36 -05:00
Mike Bayer 12073e281e - SchemaItem, SchemaType now descend from common type
SchemaEventTarget, which supplies dispatch
- the dispatch now provides before_parent_attach(),
after_parent_attach(), events which generally bound the _set_parent()
event. [ticket:2037]
- the _on_table_attach mechanism now usually uses the
event dispatch
- fixed class-level event dispatch to propagate to all subclasses, not just
immediate subclasses
- fixed class-level event unpickling to handle more involved
inheritance hierarchies, needed by the new schema event dispatch.
- ForeignKeyConstraint doesn't re-call the column attach event
on ForeignKey objects that are already associated with the correct
Column
- we still need that ImportError on mysqldb CLIENT FLAGS to support
mock DBAPIs
2011-01-30 20:29:48 -05:00
Mike Bayer 41d222b5f8 - Added some defs to the resultproxy.c extension so that
the extension compiles and runs on Python 2.4.
    [ticket:2023]
2011-01-30 15:08:41 -05:00
Mike Bayer 7ad7dde6a5 - A warning is emitted when a joined-table inheriting mapper
has no primary keys on the locally mapped table
    (but has pks on the superclass table).  [ticket:2019]
2011-01-30 14:18:01 -05:00
Mike Bayer c05a8988bb yikes, change that name on the Alias class too 2011-01-30 14:12:03 -05:00
Mike Bayer 7ac30f96b9 - Added a name argument to Query.subquery(), to allow
a fixed name to be assigned to the alias object.
[ticket:2030]
- changed the kw name 'alias' to 'name' on the alias() standalone
function.
- fixed up some alias/join docstrings
2011-01-30 13:39:08 -05:00
Mike Bayer 1c1ff92fa9 - Column.copy(), as used in table.tometadata(), copies the
'doc' attribute.  [ticket:2028]
2011-01-30 13:09:45 -05:00
Mike Bayer d7b0e194db fix this to work on 2.4 2011-01-26 11:50:00 -05:00