Commit Graph

90 Commits

Author SHA1 Message Date
Jason Kirtland 93d212a138 - merged in the combined patch for #474, #475, #476 (attached to #476) and a new set of tests 2007-04-19 19:35:03 +00:00
Mike Bayer 4fffc21c87 - the "where" criterion of an update() and delete() now correlates
embedded select() statements against the table being updated or
deleted.  this works the same as nested select() statement
correlation, and can be disabled via the correlate=False flag on
the embedded select().
2007-04-18 22:54:40 +00:00
Mike Bayer aabb6e530b - the dialects within sqlalchemy.databases become a setuptools
entry points. loading the built-in database dialects works the
same as always, but if none found will fall back to trying
pkg_resources to load an external module [ticket:521]
2007-04-17 20:49:35 +00:00
Mike Bayer 07cd648f3f - got unicode schemas to work with postgres
- unicode schema with mysql slightly improved, still cant do has_table
- got reflection of unicode schemas working with sqlite, pg, mysql
2007-04-15 22:04:53 +00:00
Mike Bayer b9ce8e38c9 - small fix to allow successive compiles of the same SELECT object
which features LIMIT/OFFSET.  oracle dialect needs to modify
the object to have ROW_NUMBER OVER and wasn't performing
the full series of steps on successive compiles.
2007-04-13 22:22:07 +00:00
Mike Bayer aee39b2847 - the "mini" column labels generated when using subqueries, which
are to work around glitchy SQLite behavior that doesnt understand
"foo.id" as equivalent to "id", are now only generated in the case
that those named columns are selected from (part of [ticket:513])
- MS-SQL better detects when a query is a subquery and knows not to
generate ORDER BY phrases for those [ticket:513]
2007-04-11 20:55:27 +00:00
Mike Bayer cdceb3c371 - merged the "execcontext" branch, refactors engine/dialect codepaths
- much more functionality moved into ExecutionContext, which impacted
the API used by dialects to some degree
- ResultProxy and subclasses now designed sanely
- merged patch for #522, Unicode subclasses String directly,
MSNVarchar implements for MS-SQL, removed MSUnicode.
- String moves its "VARCHAR"/"TEXT" switchy thing into
"get_search_list()" function, which VARCHAR and CHAR can override
to not return TEXT in any case (didnt do the latter yet)
- implements server side cursors for postgres, unit tests, #514
- includes overhaul of dbapi import strategy #480, all dbapi
importing happens in dialect method "dbapi()", is only called
inside of create_engine() for default and threadlocal strategies.
Dialect subclasses have a datamember "dbapi" referencing the loaded
module which may be None.
- added "mock" engine strategy, doesnt require DBAPI module and
gives you a "Connecition" which just sends all executes to a callable.
can be used to create string output of create_all()/drop_all().
2007-04-02 21:36:11 +00:00
Mike Bayer e9bbf54b71 added keys() to ColumnParameters, needed for setbindparamsizes traversal 2007-03-28 23:30:22 +00:00
Mike Bayer c13846c6b6 - sending None as an argument to func.<something> will produce
an argument of NULL
2007-03-28 23:18:04 +00:00
Mike Bayer e0b638a704 - column label and bind param "truncation" also generate
deterministic names now, based on their ordering within the
full statement being compiled.  this means the same statement
will produce the same string across application restarts and
allowing DB query plan caching to work better.
- cleanup to sql.ClauseParameters since it was just falling
apart, API made more explicit
- many unit test tweaks to adjust for bind params not being
"pre" truncated, changes to ClauseParameters
2007-03-28 07:19:14 +00:00
Mike Bayer ccbcbda43e added label truncation for bind param names which was lost in the previous related commit.
added more tests plus test for column targeting with text() clause.
2007-03-28 01:39:58 +00:00
Mike Bayer 0491452799 - fix for fetchmany() "size" argument being positional in most
dbapis [ticket:505]
2007-03-28 00:09:55 +00:00
Mike Bayer 32440f2b3b - preliminary support for unicode table and column names added. 2007-03-27 16:04:34 +00:00
Mike Bayer 748f9b9acf - column labels are now generated in the compilation phase, which
means their lengths are dialect-dependent.  So on oracle a label
that gets truncated to 30 chars will go out to 63 characters
on postgres.  Also, the true labelname is always attached as the
accessor on the parent Selectable so theres no need to be aware
of the genrerated label names [ticket:512].
- ResultProxy column targeting is greatly simplified, and relies
upon the ANSICompiler's column_labels map to translate the built-in
label on a _ColumnClause (which is now considered to be a unique
identifier of that column) to the label which was generated at compile
time.
- still need to put a baseline of ColumnClause targeting for
ResultProxy objects that originated from a textual query.
2007-03-24 19:24:27 +00:00
Mike Bayer cef652a2d6 - slightly better support for bind params as column clauses, either
via bindparam() or via literal(), i.e. select([literal('foo')])
- removed "table" argument from column().  this does not add the column
to the table anyway so was misleading.
- Select _exportable_columns() only exports Selectable instances
- Select uses _exportable_columns() when searching for engines
instead of _raw_columns for similar reasons (non selectables have no engine)
- _BindParamClause no longer has a _make_proxy().  its not a ColumnElement.
- _Label detects underlying column element and will generate its own
column()._make_proxy() if the element is not a ColumnElement.  this
allows a Label to be declared for nearly anything and it can export
itself as a column on a containing Selectable.
2007-03-21 20:43:34 +00:00
Mike Bayer c249066dbf "alltests" runners call testbase.main(), which takes an optional suite,
so that exit code is propigated
2007-03-15 18:11:05 +00:00
Rick Morrison 30b20e3c56 MSSQL now passes still more unit tests [ticket:481]
Fix to null FLOAT fields in mssql-trusted.patch
MSSQL: LIMIT with OFFSET now raises an error
MSSQL: can now specify Windows authorization
MSSQL: ignores seconds on DATE columns (DATE fix, part 1)
2007-03-15 02:31:15 +00:00
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