Commit Graph

55 Commits

Author SHA1 Message Date
Ants Aasma 6bbc7dd157 change the in_ API to accept a sequence or a selectable [ticket:750] 2007-10-16 22:57:05 +00:00
Mike Bayer 9b22fc0a9b - Fixed SQL compiler's awareness of top-level column labels as used
in result-set processing; nested selects which contain the same column
  names don't affect the result or conflict with result-column metadata.

- query.get() and related functions (like many-to-one lazyloading)
  use compile-time-aliased bind parameter names, to prevent
  name conflicts with bind parameters that already exist in the
  mapped selectable.
2007-10-16 16:03:59 +00:00
Jason Kirtland 9226871456 Fixed a couple of typos & hardened against future similar errors. 2007-10-16 01:17:39 +00:00
Jason Kirtland 833503ed23 More ORDER BY, now with use_labels. 2007-10-12 18:08:11 +00:00
Jason Kirtland df929d364d - Added small DESC exercise to test_order_by. 2007-10-12 17:46:42 +00:00
Jason Kirtland d174b3bd72 Added query coverage for ORDER BY over regular, aliased and DISTINCT columns. 2007-10-11 22:21:33 +00:00
Jason Kirtland 14563004a4 - Expanded JoinTest further, exercising joins the ORM depends on explicitly
in the 'sql' tests.
2007-10-10 20:42:58 +00:00
Mike Bayer ddf875dd0c - initial sybase support checkin, [ticket:785] 2007-10-10 15:19:28 +00:00
Jason Kirtland 2b084b76c0 - Expanded the outer join tests, now covering a situation that looked like it would be wonky in oracle. 2007-10-08 03:31:52 +00:00
Jason Kirtland afa713d9e8 - Loosened up test_cant_execute_join for oracle (probably) + bonus typo fix
- Some docstring formatting waiting for pg to finish the tests...  waiting...
2007-10-08 03:01:04 +00:00
Jason Kirtland 849743acac - Added some outerjoin() execution exercises to the query tests. 2007-10-08 02:17:07 +00:00
Jason Kirtland 585b425850 - Squashed assumption of transparent type coercion support in defaults test 2007-10-07 21:57:42 +00:00
Jason Kirtland a014d289f6 - Tweaked unordered select tests to not be sensitive to result set order, also split apart some tests (aliases) that sapdb has problems with. 2007-10-07 02:01:49 +00:00
Roger Demetrescu 11c70f9d8d Firebird dialect now uses SingletonThreadPool as its poolclass.
(this fixes all "unsuccessful metadata update\n  object XXXXX is in use" test errors)

Minor fixes in tests
2007-10-07 00:06:05 +00:00
Mike Bayer f67fcd1822 - move PG RETURNING tests to postgres dialect test
- added server_version_info() support for PG dialect
- exclude PG versions < 8.4 for RETURNING tests
2007-10-04 03:19:38 +00:00
Ants Aasma e82ca71cc5 add support for returning results from inserts and updates for postgresql 8.2+. [ticket:797] 2007-10-02 23:57:54 +00:00
Mike Bayer 3e672bbfc8 - created a link between QueryContext and SelectionContext; the attribute
dictionary of QueryContext is now passed to SelectionContext inside
of Query.instances(), allowing messages to be passed between the two stages.
- removed the recent "exact match" behavior of Alias objects, they're back to
their usual behavior.
- tightened up the relationship between the Query's generation
  of "eager load" aliases, and Query.instances() which actually grabs the
  eagerly loaded rows.  If the aliases were not specifically generated for
  that statement by EagerLoader, the EagerLoader will not take effect
  when the rows are fetched.  This prevents columns from being grabbed accidentally
  as being part of an eager load when they were not meant for such, which can happen
  with textual SQL as well as some inheritance situations.  It's particularly important
  since the "anonymous aliasing" of columns uses simple integer counts now to generate
  labels.
2007-09-26 17:08:19 +00:00
Mike Bayer a0838e0c47 - columns from Alias objects, when used to target result-row columns, must match exactly
to the label used in the generated statement.  This is so searching for columns in a
  result row which match aliases won't accidentally match non-aliased columns.
  fixes errors which can arise in eager loading scenarios.
2007-09-24 19:27:52 +00:00
Mike Bayer 3126d464e7 - removed "parameters" argument from clauseelement.compile(), replaced with
"column_keys".  the parameters sent to execute() only interact with the
  insert/update statement compilation process in terms of the column names
  present but not the values for those columns.
  produces more consistent execute/executemany behavior, simplifies things a
  bit internally.
2007-09-04 00:08:57 +00:00
Jason Kirtland 6228e72cb1 - omitted 'table' and 'column' from 'from sqlalchemy import *'
- also omitted all modules and classes that aren't expicitly public
- omitted 'Smallinteger' (small i), but it's still in schema
- omitted NullType-related items from types.__all__
- patched up a few tests to use sql.table and sql.column, other related.
2007-08-21 01:31:23 +00:00
Ants Aasma be16b15f2c an early out processing insert/update column parameters was a bit too early. 2007-08-19 23:01:44 +00:00
Mike Bayer 7c6c1b99c2 1. Module layout. sql.py and related move into a package called "sql".
2. compiler names changed to be less verbose, unused classes removed.
3. Methods on Dialect which return compilers, schema generators, identifier preparers
have changed to direct class references, typically on the Dialect class itself
or optionally as attributes on an individual Dialect instance if conditional behavior is needed.
This takes away the need for Dialect subclasses to know how to instantiate these
objects, and also reduces method overhead by one call for each one.
4. as a result of 3., some internal signatures have changed for things like compiler() (now statement_compiler()), preparer(), etc., mostly in that the dialect needs to be passed explicitly as the first argument (since they are just class references now).  The compiler() method on Engine and Connection is now also named statement_compiler(), but as before does not take the dialect as an argument.

5. changed _process_row function on RowProxy to be a class reference, cuts out 50K method calls from insertspeed.py
2007-08-18 21:37:48 +00:00
Jason Kirtland ce0d72e68a Allow '$' in bind param detection [ticket:719], added test suite & fixed an edge case 2007-08-09 22:10:16 +00:00
Mike Bayer ed4fc64bb0 merging 0.4 branch to trunk. see CHANGES for details. 0.3 moves to maintenance branch in branches/rel_0_3. 2007-07-27 04:08:53 +00:00
Paul Johnston a966505992 Properly escape table names when reflecting for mssql and sqlite [ticket:653] 2007-07-17 20:13:36 +00:00
Mike Bayer 8cb8daaafe - fixed "ambiguous column" result detection, when dupe col names exist
in a result [ticket:657]
2007-07-15 15:40:09 +00:00
Jason Kirtland 177d30cc01 - Deprecated DynamicMetaData- use ThreadLocalMetaData or MetaData instead
- Deprecated BoundMetaData- use MetaData instead
- Removed DMD and BMD from documentation
2007-07-06 00:58:09 +00:00
Mike Bayer 3f3d84e754 postgres:
- added support for reflection of domains [ticket:570]
    - types which are missing during reflection resolve to Null type
      instead of raising an error
    - moved reflection/types/query unit tests specific to postgres to new
      postgres unittest module
2007-06-29 23:50:25 +00:00
Ants Aasma 51c0d90c8d add missing grouping for compound selects. fixes ticket #623 2007-06-26 18:00:57 +00:00
Ants Aasma b191254d8a fix #624, modulo operator escaping on mysql and postgres
someone should test this with oracle, firebird and sql server also
2007-06-26 16:37:30 +00:00
Mike Bayer bc58df9c1f - fixed precedence of operators so that parenthesis are correctly applied
[ticket:620]
- calling <column>.in_() (i.e. with no arguments) will return
"CASE WHEN (<column> IS NULL) THEN NULL ELSE 0 END = 1)", so that
NULL or False is returned in all cases, rather than throwing an error
[ticket:545]
2007-06-25 17:07:25 +00:00
Mike Bayer 909758df8e - result.last_inserted_ids() should return a list that is identically
sized to the primary key constraint of the table.  values that were
"passively" created and not available via cursor.lastrowid will be None.
- sqlite: string PK column inserts dont get overwritten with OID [ticket:603]
2007-06-17 00:49:08 +00:00
Paul Johnston 2c65ce7536 Multiple MSSQL fixes; see ticket #581 2007-06-13 18:53:16 +00:00
Mike Bayer ae4b954b1a - parenthesis are applied to clauses via a new _Grouping construct.
uses operator precedence to more intelligently apply parenthesis
to clauses, provides cleaner nesting of clauses (doesnt mutate
clauses placed in other clauses, i.e. no 'parens' flag)
- added 'modifier' keyword, works like func.<foo> except does not
add parenthesis.  e.g. select([modifier.DISTINCT(...)]) etc.
2007-05-14 22:25:36 +00:00
Rick Morrison 22278d02b9 - mssql: replace "select @@identity" with "select @@scope_identity". Should help avoid returning wrong ID when insert triggers are used. Also add unit test (thanks paj)
- mssql: if no db-api module specified, probe in the order [pyodbc, pymssql, adodbapi]
2007-04-29 20:00:43 +00:00
Jason Kirtland 6a30f0ee37 - Fully specify ordering for ordered union test comparison 2007-04-27 00:29:23 +00:00
Mike Bayer 38c6c7ffdf - added a col label to help sqlite with order by 2007-04-24 21:51:40 +00:00
Mike Bayer 49f633b7d1 - fix to case() construct to propigate the type of the first
WHEN condition as the return type of the case statement
- various unit test tweaks to get oracle working
2007-04-24 21:33: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 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
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
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
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 ab0a6cf6a8 unit test for "cant execute" 2007-02-02 18:26:42 +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 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 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