Commit Graph

73 Commits

Author SHA1 Message Date
Rick Morrison bfbbb2afb1 fix CASE statement when else_ is zero 2007-03-15 01:58:46 +00:00
Mike Bayer 6a3c374b95 - for hackers, refactored the "visitor" system of ClauseElement and
SchemaItem so that the traversal of items is controlled by the
ClauseVisitor itself, using the method visitor.traverse(item).
accept_visitor() methods can still be called directly but will
not do any traversal of child items.  ClauseElement/SchemaItem now
have a configurable get_children() method to return the collection
of child elements for each parent object. This allows the full
traversal of items to be clear and unambiguous (as well as loggable),
with an easy method of limiting a traversal (just pass flags which
are picked up by appropriate get_children() methods). [ticket:501]
- accept_schema_visitor() methods removed, replaced with
get_children(schema_visitor=True)
- various docstring/changelog cleanup/reformatting
2007-03-11 20:52:02 +00:00
Mike Bayer 320cb9b75f - oracle:
- got binary working for any size input !  cx_oracle works fine,
      it was my fault as BINARY was being passed and not BLOB for
      setinputsizes (also unit tests werent even setting input sizes).
    - auto_setinputsizes defaults to True for Oracle, fixed cases where
      it improperly propigated bad types.
2007-03-10 23:31:40 +00:00
Mike Bayer 46b82976bf - fixed use_alter flag on ForeignKeyConstraint [ticket:503] 2007-03-07 18:05:39 +00:00
Mike Bayer e736817a92 - bindparam() names are now repeatable! specify two
distinct bindparam()s with the same name in a single statement,
and the key will be shared.  proper positional/named args translate
at compile time.  for the old behavior of "aliasing" bind parameters
with conflicting names, specify "unique=True" - this option is
still used internally for all the auto-genererated (value-based)
     bind parameters.
2007-03-03 21:02:26 +00:00
Mike Bayer 7e2ae824a5 - use_labels flag on select() wont auto-create labels for literal text
column elements, since we can make no assumptions about the text. to
create labels for literal columns, you can say "somecol AS somelabel",
or use literal_column("somecol").label("somelabel")
- quoting wont occur for literal columns when they are "proxied" into the
column collection for their selectable (is_literal flag is propigated)
2007-03-01 20:14:17 +00:00
Mike Bayer ba5337982e - fixed function execution with explicit connections, when you dont
explicitly say "select()" off the function, i.e.
conn.execute(func.dosomething())
2007-02-27 19:04:43 +00:00
Mike Bayer abc9971544 fix typo 2007-02-25 01:24:33 +00:00
Mike Bayer 41802e102c - correlated subqueries work inside of ORDER BY, GROUP BY 2007-02-24 00:17:08 +00:00
Mike Bayer 736bc3bd51 - exists() becomes useable as a standalone selectable, not just in a
WHERE clause
2007-02-23 20:46:27 +00:00
Mike Bayer 6458a670c0 reverted unit test change 2007-02-19 04:36:18 +00:00
Rick Morrison e7ac502b81 Completed previously missed patches from tickets 422 and 415
get unit tests to work with pyodbc [ticket:481]
fix blank password on adodbapi [ticket:371]
2007-02-18 19:43:05 +00:00
Mike Bayer b5bb6bb06d - fixed generation of CHECK constraints on columns [ticket:464] 2007-02-17 03:46:13 +00:00
Mike Bayer 225e51a796 - added a Sequence to the unicode test tables to help Oracle
- fixed named PrimaryKeyConstraint generation on oracle [ticket:466] courtesy andrija at gmail
2007-02-17 02:31:56 +00:00
Mike Bayer 5f83c55fc7 - fixed oracle list of binary types to check for their presence in the module (such as BFILE not in all versions of cx_Oracle)
- removed oracle-handicap from binary unit test to test [ticket:435] fix, added an extra row containing None
2007-02-17 01:18:54 +00:00
Mike Bayer 80f48f250b - added literal_column() to specify a column clause that should not undergo any quoting
- straight text sent to select() added as literal_column
- fix for issue in [ticket:450]
2007-02-04 03:43:22 +00:00
Mike Bayer a8cdead326 - more quoting fixes for [ticket:450]...quoting more aggressive (but still skips already-quoted literals)
- got mysql to have "format" as default paramstyle even if mysql module not available, allows unit tests
to pass in non-mysql system for [ticket:457].  all the dialects should be changed to pass in their usual
paramstyle.
2007-02-04 03:12:27 +00:00
Mike Bayer 5ce214c7d4 - sequences on a non-pk column will properly fire off on INSERT for PG/oracle 2007-02-02 18:58:11 +00:00
Mike Bayer ab0a6cf6a8 unit test for "cant execute" 2007-02-02 18:26:42 +00:00
Mike Bayer ac4b2a8d18 fixes to quoting on "fake" column when used off its table 2007-01-29 22:41:53 +00:00
Mike Bayer bbc5e7c285 merged the polymorphic relationship refactoring branch in. i want to go further on that branch and introduce the foreign_keys argument, and further centralize the "intelligence" about the joins and selectables into PropertyLoader so that lazyloader/sync can be simplified, but the current branch goes pretty far.
- relations keep track of "polymorphic_primaryjoin", "polymorphic_secondaryjoin" which it derives from the plain primaryjoin/secondaryjoin.
  - lazy/eagerloaders work from those polymorphic join objects.
  - the join exported by PropertyLoader to Query/SelectResults is the polymorphic join, so that join_to/etc work properly.
  - Query builds itself against the base Mapper again, not the "polymorphic" mapper.  uses the "polymorphic" version
 only as appropriate.  this helps join_by/join_to/etc to work with polymorphic mappers.
  - Query will also adapt incoming WHERE criterion to the polymorphic mapper, i.e. the "people" table becomes the "person_join" automatically.
  - quoting has been modified since labels made out of non-case-sensitive columns could themselves require quoting..so case_sensitive defaults to True if not otherwise specified (used to be based on the identifier itself).
  - the test harness gets an ORMTest base class and a bunch of the ORM unit tests are using it now, decreases a lot of redundancy.
2007-01-28 23:33:53 +00:00
Mike Bayer b8662333bb - *slight* support for binary, but still need to figure out how to insert reasonably large
values (over 4K).  requires auto_setinputsizes=True sent to create_engine(), rows must
be fully fetched individually, etc.
2007-01-23 20:25:48 +00:00
Mike Bayer c95faa5e8d - mysql table create options work on a generic passthru now, i.e. Table(..., mysql_engine='InnoDB',
mysql_collate="latin1_german2_ci", mysql_auto_increment="5", mysql_<somearg>...),
helps [ticket:418]
2007-01-20 21:00:08 +00:00
Mike Bayer 37a61a1b49 - another fix to subquery correlation so that a subquery which has only one FROM
element will *not* correlate that single element, since at least one FROM element is
required in a query.
2007-01-19 02:19:38 +00:00
Mike Bayer 35fcfbc083 added testcase to ensure that type gets propigated from scalar subquery to its label 2007-01-16 23:23:19 +00:00
Mike Bayer 437f1ce670 - postgres cursor option is now server_side_cursors=False; some users get bad results using them
so theyre off by default
- type system slightly modified to support TypeDecorators that can be overridden by the dialect
- added an NVarchar type to mssql (produces NVARCHAR), also MSUnicode which provides Unicode-translation
for the NVarchar regardless of dialect convert_unicode setting.
2007-01-14 20:21:36 +00:00
Mike Bayer a4c73cc8ae - the "op()" function is now treated as an "operation", rather than a "comparison".
the difference is, an operation produces a BinaryExpression from which further operations
  can occur whereas comparison produces the more restrictive BooleanExpression
2007-01-08 19:09:02 +00:00
Mike Bayer 5369b3df8c - fix to correlation of subqueries when the column list of the select statement
is constructed with individual calls to append_column(); this fixes an ORM
bug whereby nested select statements were not getting correlated with the
main select generated by the Query object.
2006-12-28 00:27:58 +00:00
Mike Bayer 422558bc5d fix to the fix for [ticket:396] plus a unit test 2006-12-15 01:07:05 +00:00
Mike Bayer 13d989b2d0 - sending a selectable to an IN no longer creates a "union" out of multiple
selects; only one selectable to an IN is allowed now (make a union yourself
if union is needed; explicit better than implicit, dont guess, etc.)
2006-11-29 22:13:58 +00:00
Mike Bayer b6b0130646 - made kwargs parsing to Table strict; removed various obsoluete "redefine=True" kw's from the unit tests
- documented instance variables in ANSICompiler
- fixed [ticket:120], adds "inline_params" set to ANSICompiler which DefaultDialect picks up on when
determining defaults.  added unittests to query.py
- additionally fixed up the behavior of the "values" parameter on _Insert/_Update
- more cleanup to sql/Select - more succinct organization of FROM clauses, removed silly _process_from_dict
methods and JoinMarker object
2006-11-26 02:36:27 +00:00
Mike Bayer 19fcb943c4 - cleanup on some instance vars in Select (is_scalar, is_subquery, _froms is __froms, removed unused 'nowait', '_text', etc)
- cleaned up __repr__ on Column, AbstractTypeEngine
- added standalone intersect(_all), except(_all) functions, unit tests illustrating nesting patterns [ticket:247]
2006-11-25 21:32:26 +00:00
Mike Bayer 8a2ed6de4f fix to oracle types test, added RAW type [ticket:378] 2006-11-21 22:20:31 +00:00
Mike Bayer f60151ebd3 - fixed direct execution of Compiled objects 2006-10-31 15:58:51 +00:00
Mike Bayer 9bb80a8f11 figured out how a Select can be in its own _froms list, changed assertion to just a continue 2006-10-31 00:51:16 +00:00
Mike Bayer 76597e533f fixed binary types test to use two binary files specifically for testing, instead of
attempting to grab .pyc files
2006-10-30 01:29:43 +00:00
Mike Bayer 4273dd4cfe further fixes to sqlite booleans, weren't working as defaults 2006-10-29 02:40:27 +00:00
Mike Bayer 066d8dc79c added string length to avoid LOB col type in oracle 2006-10-22 05:50:03 +00:00
Mike Bayer 45b6c7d778 added __getattr__() proxy to TypeDecorator 2006-10-22 00:42:43 +00:00
Mike Bayer 0d75e5961c - [ticket:346], session closing the connection on flush
- added unicode assertion for sqlite
2006-10-19 02:52:31 +00:00
Mike Bayer 8340006dd7 - a fair amount of cleanup to the schema package, removal of ambiguous
methods, methods that are no longer needed.  slightly more constrained
useage, greater emphasis on explicitness.
- table_iterator signature fixup, includes fix for [ticket:288]
- the "primary_key" attribute of Table and other selectables becomes
a setlike ColumnCollection object; is no longer ordered or numerically
indexed.  a comparison clause between two pks that are derived from the
same underlying tables (i.e. such as two Alias objects) can be generated
via table1.primary_key==table2.primary_key
- append_item() methods removed from Table and Column; preferably
construct Table/Column/related objects inline, but if needed use
append_column(), append_foreign_key(), append_constraint(), etc.
- table.create() no longer returns the Table object, instead has no
return value.  the usual case is that tables are created via metadata,
which is preferable since it will handle table dependencies.
- added UniqueConstraint (goes at Table level), CheckConstraint
(goes at Table or Column level) fixes [ticket:217]
- index=False/unique=True on Column now creates a UniqueConstraint,
index=True/unique=False creates a plain Index,
index=True/unique=True on Column creates a unique Index.  'index'
and 'unique' keyword arguments to column are now boolean only; for
explcit names and groupings of indexes or unique constraints, use the
UniqueConstraint/Index constructs explicitly.
- relationship of Metadata/Table/SchemaGenerator/Dropper has been
improved so that the schemavisitor receives the metadata object
for greater control over groupings of creates/drops.
- added "use_alter" argument to ForeignKey, ForeignKeyConstraint,
but it doesnt do anything yet.  will utilize new generator/dropper
behavior to implement.
2006-10-14 21:58:04 +00:00
Mike Bayer e16bfad407 - fixes to Date/Time (SLDate/SLTime) types; works as good as postgres
now [ticket:335]
2006-10-12 01:12:17 +00:00
Mike Bayer 758828ed54 assorted firebird fixes from Lele Gaifax 2006-10-07 00:54:14 +00:00
Mike Bayer bbd7c66056 - Function objects know what to do in a FROM clause now. their
behavior should be the same, except now you can also do things like
    select(['*'], from_obj=[func.my_function()]) to get multiple
    columns from the result, or even use sql.column() constructs to name the
    return columns [ticket:172].  generally only postgres understands the
    syntax (and possibly oracle).
2006-10-03 23:00:04 +00:00
Mike Bayer ec6d7b3900 formatting fixup, etc. 2006-10-03 22:56:54 +00:00
Mike Bayer 73f145dc0e - added auto_setinputsizes=False to oracle dialect. if true, all executions will get setinputsizes called ahead of time.
- some tweaks to the types unittest for oracle.  oracle types still need lots more work.
2006-10-03 21:47:48 +00:00
Mike Bayer 93caa5da2e decruftify 2006-09-28 02:13:37 +00:00
Mike Bayer e812785c2d - logging is now implemented via standard python "logging" module.
"echo" keyword parameters are still functional but set/unset
log levels for their respective classes/instances.  all logging
can be controlled directly through the Python API by setting
INFO and DEBUG levels for loggers in the "sqlalchemy" namespace.
class-level logging is under "sqlalchemy.<module>.<classname>",
instance-level logging under "sqlalchemy.<module>.<classname>.<hexid>".
Test suite includes "--log-info" and "--log-debug" arguments
which work independently of --verbose/--quiet.  Logging added
to orm to allow tracking of mapper configurations, row iteration
fixes [ticket:229] [ticket:79]
2006-09-24 23:59:22 +00:00
Mike Bayer 7d74fc7785 - added "pickleable" module to test suite to have cPickle-compatible
test objects
- added copy_function, compare_function arguments to InstrumentedAttribute
- added MutableType mixin, copy_value/compare_values methods to TypeEngine,
PickleType
- ColumnProperty and DeferredProperty propigate the TypeEngine copy/compare
methods to the attribute instrumentation
- cleanup of UnitOfWork, removed unused methods
- UnitOfWork "dirty" list is calculated across the total collection of persistent
objects when called, no longer has register_dirty.
- attribute system can still report "modified" status fairly quickly, but does
extra work for InstrumentedAttributes that have detected a "mutable" type where
catching the __set__() event is not enough (i.e. PickleTypes)
- attribute tracking modified to be more intelligent about detecting
changes, particularly with mutable types.  TypeEngine objects now
take a greater role in defining how to compare two scalar instances,
including the addition of a MutableType mixin which is implemented by
PickleType.  unit-of-work now tracks the "dirty" list as an expression
of all persistent objects where the attribute manager detects changes.
The basic issue thats fixed is detecting changes on PickleType
objects, but also generalizes type handling and "modified" object
checking to be more complete and extensible.
2006-09-23 20:26:20 +00:00
Mike Bayer 372a8d76a6 - added autoincrement=True to Column; will disable schema generation
of SERIAL/AUTO_INCREMENT/identity seq for postgres/mysql/mssql if
explicitly set to False.  #303
2006-09-23 17:21:56 +00:00