Commit Graph

413 Commits

Author SHA1 Message Date
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
Mike Bayer 03b5b34114 - anonymous alias names now truncate down to the max length
allowed by the dialect.  More significant on DBs like
Oracle with very small character limits. [ticket:1309]
2009-02-10 01:20:45 +00:00
Mike Bayer e39b98ca7b - Fixed missing _label attribute on Function object, others
when used in a select() with use_labels (such as when used
in an ORM column_property()).  [ticket:1302]
2009-02-01 18:20:20 +00:00
Mike Bayer 397ba5d73d - _CalculatedClause is gone
- Function rolls the various standalone execution functionality of CC into itself,
accesses its internal state more directly
- collate just uses _BinaryExpression, don't know why it didn't do this already
- added new _Case construct, compiles directly
- the world is a happier place
2009-01-28 01:28:20 +00:00
Mike Bayer 072039945b - Further fixes to the "percent signs and spaces in column/table
names" functionality. [ticket:1284]
- Still doesn't work for PG/MySQL, which unfortunately would require
post_process_text() calls all over the place.  Perhaps % escaping
can be assembled into IdentifierPreparer.quote() since that's where
identifier names are received.
2009-01-18 17:08:28 +00:00
Mike Bayer 454f1d7f58 - Query.from_self() as well as query.subquery() both disable
the rendering of eager joins inside the subquery produced.
The "disable all eager joins" feature is available publically
via a new query.enable_eagerloads() generative. [ticket:1276]
- Added a rudimental series of set operations to Query that
receive Query objects as arguments, including union(),
union_all(), intersect(), except_(), insertsect_all(),
except_all().  See the API documentation for
Query.union() for examples.
- Fixed bug that prevented Query.join() and eagerloads from
attaching to a query that selected from a union or aliased union.
2009-01-15 17:08:56 +00:00
Mike Bayer 76a7818013 - Improved the methodology to handling percent signs in column
names from [ticket:1256].  Added more tests.  MySQL and
Postgres dialects still do not issue correct CREATE TABLE
statements for identifiers with percent signs in them.
2009-01-14 19:55:20 +00:00
Mike Bayer 9fe69cb503 - Fixed some deep "column correspondence" issues which could
impact a Query made against a selectable containing
multiple versions of the same table, as well as
unions and similar which contained the same table columns
in different column positions at different levels.
[ticket:1268]
2009-01-03 02:42:34 +00:00
Mike Bayer 5bc1f17cb5 - mysql, postgres: "%" signs in text() constructs are automatically escaped to "%%".
Because of the backwards incompatible nature of this change,
a warning is emitted if '%%' is detected in the string.  [ticket:1267]
2009-01-02 21:24:17 +00:00
Michael Trier f62a78242d Modifications to the mssql dialect in order to to pass through unicode in the pyodbc dialect. 2008-12-30 06:39:37 +00:00
Michael Trier 8669eda82d Added in a new MSGenericBinary type.
This maps to the Binary type so it can implement the specialized behavior of
treating length specified types as fixed-width Binary types and non-length
types as an unbound variable length Binary type.
2008-12-28 21:07:57 +00:00
Mike Bayer 7009653aa1 - RowProxy objects can be used in place of dictionary arguments
sent to connection.execute() and friends.  [ticket:935]
2008-12-28 20:58:38 +00:00
Michael Trier cae83f6d4f On MSSQL if a field is part of the primary_key then it should not allow NULLS. 2008-12-28 07:40:56 +00:00
Mike Bayer 6cf4db7df3 - Columns can again contain percent signs within their
names. [ticket:1256]
2008-12-23 01:22:54 +00:00
Michael Trier 886ddcd12d Major refactoring of the MSSQL dialect. Thanks zzzeek.
Includes simplifying the IDENTITY handling and the exception handling. Also
includes a cleanup of the connection string handling for pyodbc to favor
the DSN syntax.
2008-12-22 20:20:55 +00:00
Michael Trier 0dc8bce4fe Corrected ColumnsTest for mssql's new explicit nullability behavior. 2008-12-20 22:35:06 +00:00
Mike Bayer d76dc73f33 merge the test/ directory from -r5438:5439 of py3k_warnings branch. this gives
us a 2.5-frozen copy of unittest so we're insulated from unittest changes.
2008-12-18 18:11:12 +00:00
Mike Bayer be5d326343 merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 testing issues,
and also addresses a significant chunk of py3k deprecations.  It's mainly
expicit __hash__ methods.  Additionally, most usage of sets/dicts to store columns uses
util-based placeholder names.
2008-12-18 17:57:15 +00:00
Mike Bayer b333789336 - Query() can be passed a "composite" attribute
as a column expression and it will be expanded.
Somewhat related to [ticket:1253].
- Query() is a little more robust when passed
various column expressions such as strings,
clauselists, text() constructs (which may mean
it just raises an error more nicely).
- select() can accept a ClauseList as a column
in the same way as a Table or other selectable
and the interior expressions will be used as
column elements. [ticket:1253]
- removed erroneous FooTest from test/orm/query

-This line, and those below, will be ignored--

M    test/orm/query.py
M    test/orm/mapper.py
M    test/sql/select.py
M    lib/sqlalchemy/orm/query.py
M    lib/sqlalchemy/sql/expression.py
M    CHANGES
2008-12-18 16:50:49 +00:00
Mike Bayer 6a99f29313 - _execute_clauseelement() goes back to being
a private method.  Subclassing Connection
is not needed now that ConnectionProxy
is available.
- tightened the interface for the various _execute_XXX()
methods to reduce ambiguity
- __distill_params() no longer creates artificial [{}] entry,
blank dict is no longer passed through to do_execute()
in any case unless explicitly sent from the outside
as in connection.execute("somestring"), {})
- fixed a few old sql.query tests which were doing that
- removed needless do_execute() from mysql dialect
- fixed charset param not properly being sent to
_compat_fetchone() in mysql
2008-12-17 23:09:51 +00:00
Michael Trier 1d90146210 Modified fails_on testing decorator to take a reason for the failure.
This should assist with helping to document the reasons for testing failures.
Currently unspecified failures are defaulted to 'FIXME: unknown'.
2008-12-12 03:41:05 +00:00
Mike Bayer b22edf1d8a - turn __visit_name__ into an explicit member.
[ticket:1244]
2008-12-11 23:28:01 +00:00
Mike Bayer f527d3b9af - PickleType now favors == comparison by default,
if the incoming object (such as a dict) implements
__eq__().  If the object does not implement
__eq__() and mutable=True, a deprecation warning
is raised.
2008-12-11 17:27:33 +00:00
Mike Bayer 6eca02a31f - union() and union_all() will not whack
any order_by() that has been applied to the
select()s inside.  If you union() a
select() with order_by() (presumably to support
LIMIT/OFFSET), you should also call self_group()
on it to apply parenthesis.
2008-12-06 00:14:50 +00:00
Mike Bayer 0410eae36b - Two fixes to help prevent out-of-band columns from
being rendered in polymorphic_union inheritance
scenarios (which then causes extra tables to be
rendered in the FROM clause causing cartesian
products):
- improvements to "column adaption" for
  a->b->c inheritance situations to better
  locate columns that are related to one
  another via multiple levels of indirection,
  rather than rendering the non-adapted
  column.
- the "polymorphic discriminator" column is
  only rendered for the actual mapper being
  queried against. The column won't be
  "pulled in" from a subclass or superclass
  mapper since it's not needed.
2008-12-03 17:28:36 +00:00
Mike Bayer 851a14aa1a - Using the same ForeignKey object repeatedly
raises an error instead of silently failing
later. [ticket:1238]
2008-12-03 14:09:34 +00:00
Michael Trier 6a9b2cb683 Flagged another transaction test as causing mssql to hang. Need to look into these. 2008-11-10 01:11:46 +00:00
Michael Trier d360fd7fe3 Corrected issue with decimal e notation that broke regular decimal tests for mssql. 2008-11-10 01:11:43 +00:00
Mike Bayer 0cff22720b - Removed the 'properties' attribute of the
Connection object, Connection.info should be used.
- Method consoliation in Connection, ExecutionContext
2008-11-09 19:32:25 +00:00
Michael Trier 4cd99f5536 Global propigate -> propagate change to correct spelling. Additionally found a couple of insures that should be ensure. 2008-11-09 01:53:08 +00:00
Michael Trier 8924a0e4fe Corrected a lot of mssql limit / offset issues. Also ensured that mssql uses the IN / NOT IN syntax when using a binary expression with a subquery. 2008-11-08 04:43:35 +00:00
Mike Bayer cfca625e94 docstring updates 2008-11-07 22:36:21 +00:00
Mike Bayer 9f894d2f26 - Dialects can now generate label names of adjustable length.
Pass in the argument "label_length=<value>" to create_engine()
to adjust how many characters max will be present in dynamically
generated column labels, i.e. "somecolumn AS somelabel".  Any
value less than 6 will result in a label of minimal size,
consiting of an underscore and a numeric counter.
The compiler uses the value of dialect.max_identifier_length
as a default. [ticket:1211]
- removed ANON_NAME regular expression, using string patterns now
- _generated_label() unicode subclass is used to indicate generated names
which are subject to truncation
2008-11-05 20:50:48 +00:00
Mike Bayer a5dfbeedb9 - Improved the behavior of aliased() objects such that they more
accurately adapt the expressions generated, which helps
particularly with self-referential comparisons. [ticket:1171]

- Fixed bug involving primaryjoin/secondaryjoin conditions
constructed from class-bound attributes (as often occurs
when using declarative), which later would be inappropriately
aliased by Query, particularly with the various EXISTS
based comparators.
2008-11-03 02:52:30 +00:00
Mike Bayer 50719c0bb0 revert r5220 inadvertently committed to trunk 2008-11-02 22:11:40 +00:00
Mike Bayer ff2f799ba3 progress so far 2008-11-02 22:08:24 +00:00
Mike Bayer 3bbf8037f8 - fixed some oracle unit tests in test/sql/
- wrote a docstring for oracle dialect, needs formatting perhaps
- made FIRST_ROWS optimization optional based on optimize_limits=True, [ticket:536]
2008-10-24 15:58:17 +00:00
Michael Trier 00cec7c088 Corrected the is_subquery() check based on recent changes. Excluded the test_in_filtering_advanced test for mssql. 2008-10-21 02:46:43 +00:00
Ants Aasma 11619ad8ee Slightly changed behavior of IN operator for comparing to empty collections. Now results in inequality comparison against self. More portable, but breaks with stored procedures that aren't pure functions. 2008-10-20 20:41:09 +00:00
Michael Trier c81c7ff3d5 Modifications to allow the backends to control the behavior of an empty insert. If supports_empty_insert is True then the backend specifically supports the 'insert into t1 () values ()' syntax. If supports_default_values is True then the backend supports the 'insert into t1 default values' syntax. If both are false then the backend has no support for empty inserts at all and an exception gets raised. Changes here are careful to not change current behavior except where the current behavior was failing to begin with. 2008-10-20 15:21:00 +00:00
Michael Trier 291077f364 Verified that Subqueries are not allowed in VALUES. mssql supports a SELECT syntax but only as the source of all inserts.
(cherry picked from commit 4516db6b322fb1feaa04915f09b8b4fabd6b9735)
2008-10-19 03:00:22 +00:00
Mike Bayer a20222fc22 - 0.5.0rc3, doh
- The internal notion of an "OID" or "ROWID" column has been
removed.  It's basically not used by any dialect, and the
possibility of its usage with psycopg2's cursor.lastrowid
is basically gone now that INSERT..RETURNING is available.

- Removed "default_order_by()" method on all FromClause
objects.
- profile/compile/select test is 8 function calls over on buildbot 2.4 for some reason, will adjust after checking
the results of this commit
2008-10-18 18:14:06 +00:00
Mike Bayer 223bd3688d oracle doesnt seem to like CLOB in unions.... 2008-10-18 17:45:04 +00:00
Mike Bayer 1127b10b27 - "not equals" comparisons of simple many-to-one relation
to an instance will not drop into an EXISTS clause
and will compare foreign key columns instead.

- removed not-really-working use cases of comparing
a collection to an iterable.  Use contains() to test
for collection membership.

- Further simplified SELECT compilation and its relationship
to result row processing.

- Direct execution of a union() construct will properly set up
result-row processing. [ticket:1194]
2008-10-18 17:34:52 +00:00
Michael Trier fc35f5b6e0 Unless I'm missing something mssql doesn't support and / or within column selects. Even using the case when syntax it's not possible to test truth in this manner. 2008-10-16 17:14:30 +00:00