604 Commits

Author SHA1 Message Date
Mike Bayer de5aaa27f2 - Fixed bug whereby with_only_columns() method of
Select would fail if a selectable were passed.
    [ticket:2270].   However, the FROM behavior is
    still incorrect here, so you need 0.7 in
    any case for this use case to be usable.
2011-09-21 17:28:12 -04:00
Mike Bayer c4f606a04a Backed out changeset e5737a6d89 - this only applies to 0.7 2011-07-24 19:18:04 -04:00
Mike Bayer e5737a6d89 - fix annotation for aliased() 2011-07-24 13:36:40 -04:00
Mike Bayer e1f6d074c4 - Fixed subtle bug that caused SQL to blow
up if: column_property() against subquery +
    joinedload + LIMIT + order by the column
    property() occurred.  [ticket:2188].
2011-06-27 19:44:52 -04:00
Mike Bayer 0ef1ac8d43 - Fixed a subtle bug involving column
correspondence in a selectable with the
    same column repeated.   Affects [ticket:2188].
2011-06-27 19:31:21 -04:00
Mike Bayer da043fa752 - Adjusted the __contains__() method of
a RowProxy result row such that no exception
throw is generated internally;
NoSuchColumnError() also will generate its
message regardless of whether or not the column
construct can be coerced to a string.
[ticket:2178].
2011-06-04 20:57:16 -04:00
Mike Bayer 94fc44ac02 - merge 00380cf3c3 from default
- Fixed bug whereby nesting a label of a select()
with another label in it would produce incorrect
exported columns.   Among other things this would
break an ORM column_property() mapping against
another column_property().  [ticket:2167].
2011-05-18 12:12:00 -04:00
Mike Bayer f5893458a1 - The limit/offset keywords to select() as well
as the value passed to select.limit()/offset()
will be coerced to integer.  [ticket:2116]
- Oracle dialect adds use_binds_for_limits=False
create_engine() flag, will render the LIMIT/OFFSET
values inline instead of as binds, reported to
modify the execution plan used by Oracle.
[ticket:2116]
2011-04-07 13:47:43 -04:00
Mike Bayer 38b9434cb4 - Firebird - the "implicit_returning" flag on create_engine() is
honored if set to False.  [ticket:2083]
2011-03-16 11:22:28 -04:00
Mike Bayer 81db86c8f1 - Added accessors to ResultProxy "returns_rows", "is_insert" 2011-03-16 10:39:05 -04:00
Jim Phares 4127b26e69 Informix and postgresql reserved words changes -- almost done. 2011-03-15 16:56:45 -04:00
Denise Govindarajan 7b98535f60 psycopg2 2.4 no longer accepts % in bind place holders 2011-03-15 17:47:36 -04:00
Mike Bayer 43aaeb5db9 - merge long line clenaup 2011-02-10 22:11:33 -05:00
Mike Bayer 6616278456 - adjust this test for py3k 2011-01-05 18:49:16 -05:00
Mike Bayer be08ac57ef -whitespace removal bonanza 2011-01-02 14:25:15 -05:00
Mike Bayer 0bceb861bf - fix broken py3k block 2010-12-15 13:25:16 -05:00
Mike Bayer ef9b700fb1 - we shouldn't be raising warnings on non-unicode for String type,
even if convert_unicode=True
2010-12-15 12:21:55 -05:00
Mike Bayer 77f641429f - Fixed operator precedence rules for multiple
chains of a single non-associative operator.
I.e. "x - (y - z)" will compile as "x - (y - z)"
and not "x - y - z".  Also works with labels,
i.e. "x - (y - z).label('foo')"
[ticket:1984]
- Single element tuple expressions inside an IN clause
parenthesize correctly, also from [ticket:1984],
added tests for PG
- re-fix again importlater, [ticket:1983]
2010-11-25 12:20:13 -05:00
Mike Bayer b96e6232a4 cleanup most egregiously long lines 2010-10-24 13:26:34 -04:00
Mike Bayer 79c25ede44 - Added type_coerce(expr, type_) expression element.
Treats the given expression as the given type when evaluating
expressions and processing result rows, but does not
affect the generation of SQL, other than an anonymous label.
2010-10-23 16:40:39 -04:00
Mike Bayer ee345b055c - Fixed bug in TypeDecorator whereby the dialect-specific
type was getting pulled in to generate the DDL for a
given type, which didn't always return the correct result.

- TypeDecorator can now have a fully constructed type
specified as its "impl", in addition to a type class.

- TypeDecorator will now place itself as the resulting
type for a binary expression where the type coercion
rules would normally return its impl type - previously,
a copy of the impl type would be returned which would
have the TypeDecorator embedded into it as the "dialect"
impl, this was probably an unintentional way of achieving
the desired effect.

- TypeDecorator.load_dialect_impl() returns "self.impl" by
default, i.e. not the dialect implementation type of
"self.impl".   This to support compilation correctly.
Behavior can be user-overridden in exactly the same way
as before to the same effect.
2010-10-21 16:42:32 -04:00
Mike Bayer ee9102622c - default compilation of a type will check if the type class's module is
inside of sqlalchemy.dialects, in which case that dialect's default
will be used instead of DefaultDialect.
2010-10-03 13:11:41 -04:00
Mike Bayer 761b4f29e2 - *Major* cleanup / modernization of the Informix
dialect for 0.6, courtesy Florian Apolloner.
[ticket:1906]
2010-10-01 21:26:05 -04:00
Mike Bayer a4a09a687a - Fixed recursion overflow which could occur when operating
with two expressions both of type "NullType", but
not the singleton NULLTYPE instance. [ticket:1907]
2010-09-25 18:38:01 -04:00
Mike Bayer c5c8cdf3b4 - as_scalar(), label() can be called on a selectable
which contains a Column that is not yet named.
[ticket:1862]
2010-09-18 13:34:04 -04:00
Mike Bayer 003149c504 - An informative error message is raised if a Column
which has not yet been assigned a name, i.e. as in
declarative, is used in a context where it is
exported to the columns collection of an enclosing
select() construct, or if any construct involving
that column is compiled before its name is
assigned.  [ticket:1862]
2010-09-18 13:18:44 -04:00
Mike Bayer 90d4cdbac8 - Fixed a regression in 0.6.4 whereby the change that
allowed cursor errors to be raised consistently broke
the result.lastrowid accessor.   Test coverage has
been added for result.lastrowid.   Note that lastrowid
is only supported by Pysqlite and some MySQL drivers,
so isn't super-useful in the general case.
2010-09-16 11:29:01 -04:00
Mike Bayer 9bf88fa891 - pending deprecation in 0.7 for the execute/scalar on clauseelement 2010-09-07 11:57:19 -04:00
Mike Bayer 703ce7f179 - rewrote the "connections" section
- improved pool docs
- typos etc.
- ClauseElement.execute() and scalar() make no sense - these are depreacted.
The official home is Executable.
- alias() is not executable, allowing it is sloppy so this goes under
the deprecated umbrella
2010-09-05 14:44:58 -04:00
Mike Bayer fc46270f47 - AbstractType.__str__() produces the string version of the type with default dialect
- 79 chars
2010-09-03 14:35:22 -04:00
Mike Bayer 252ab17c7d - Added basic math expression coercion for
Numeric->Integer,
so that resulting type is Numeric regardless
of the direction of the expression.
2010-08-13 14:25:58 -04:00
Mike Bayer cbb0a03a56 - the _Label construct, i.e. the one that is produced
whenever you say somecol.label(), now counts itself
in its "proxy_set" unioned with that of it's
contained column's proxy set, instead of
directly returning that of the contained column.
This allows column correspondence
operations which depend on the identity of the
_Labels themselves to return the correct result
- fixes ORM bug [ticket:1852].
2010-08-07 20:58:23 -04:00
Mike Bayer 96837098cd - the text() construct, if placed in a column
oriented situation, will at least return NULLTYPE
for its type instead of None, allowing it to
be used a little more freely for ad-hoc column
expressions than before.   literal_column()
is still the better choice, however.
2010-08-03 14:06:41 -04:00
Mike Bayer ddf4210552 - Calling fetchone() or similar on a result that
has already been exhausted, has been closed,
or is not a result-returning result now
raises ResourceClosedError, a subclass of
InvalidRequestError, in all cases, regardless
of backend.  Previously, some DBAPIs would
raise ProgrammingError (i.e. pysqlite), others
would return None leading to downstream breakages
(i.e. MySQL-python).

- Connection, ResultProxy, as well as Session use
ResourceClosedError for all "this
connection/transaction/result is closed" types of
errors.
2010-08-03 11:55:12 -04:00
Mike Bayer b2c0b50bbf - The generated index name also is based on
a "max index name length" attribute which is
separate from the "max identifier length" -
this to appease MySQL who has a max length
of 64 for index names, separate from their
overall max length of 255.  [ticket:1412]
2010-08-02 01:12:03 -04:00
Mike Bayer dabe38bf56 - Changed the scheme used to generate truncated
"auto" index names when using the "index=True"
flag on Column.   The truncation only takes
place with the auto-generated name, not one
that is user-defined (an error would be
raised instead), and the truncation scheme
itself is now based on a fragment of an md5
hash of the identifier name, so that multiple
indexes on columns with similar names still
have unique names.  [ticket:1855]
2010-07-21 11:33:47 -04:00
Mike Bayer 5cce6bf2a8 - experimenting with pytidy with mods as a textmate plugin along
the path to 78 chars.   eh
2010-07-10 14:50:13 -04:00
Mike Bayer 7dcfc49b34 fix test 2010-06-24 12:45:37 -04:00
Mike Bayer 87664ce88a - The argument to "ESCAPE" of a LIKE operator or similar
is passed through render_literal_value(), which may
implement escaping of backslashes.  [ticket:1400]
- Postgresql render_literal_value() is overridden which escapes
backslashes, currently applies to the ESCAPE clause
of LIKE and similar expressions.
Ultimately this will have to detect the value of
"standard_conforming_strings" for full behavior.
[ticket:1400]
- MySQL render_literal_value() is overridden which escapes
backslashes, currently applies to the ESCAPE clause
of LIKE and similar expressions.   This behavior
is derived from detecting the value of
NO_BACKSLASH_ESCAPES.  [ticket:1400]
2010-06-24 12:19:15 -04:00
Mike Bayer 77c3bb26c2 - Firebird dialect adds CHAR, VARCHAR types which
accept a "charset" flag, to support Firebird
"CHARACTER SET" clause.  [ticket:1813]
2010-06-19 13:51:55 -04:00
Mike Bayer 33f6dcc80b - Modified the internals of "column annotation" such that
a custom Column subclass can safely override
_constructor to return Column, for the purposes of
making "configurational" column classes that aren't
involved in proxying, etc.
2010-06-14 19:39:26 -04:00
Mike Bayer 4881873c6b fix the enum for MySQL after native_enum added to adaption keys 2010-06-09 18:27:43 -04:00
Mike Bayer 85f9619b03 - Fixed bug in Enum type which blew away native_enum
flag when used with TypeDecorators or other adaption
scenarios.
2010-06-08 19:25:15 -04:00
Mike Bayer 035ec314f6 - Fixed concatenation of constraints when "PRIMARY KEY"
constraint gets moved to column level due to SQLite
AUTOINCREMENT keyword being rendered.  [ticket:1812]
- remove some extra space in between constraint DDL
- added alias() to binary comparison test, fixing pg + mysql failures
2010-05-27 14:46:44 -04:00
Mike Bayer b086f9a815 - Re-established support for Oracle 8 with cx_oracle,
including that use_ansi is set to False automatically,
NVARCHAR2 and NCLOB are not rendered for Unicode,
"native unicode" check doesn't fail, cx_oracle
"native unicode" mode is disabled, VARCHAR() is emitted
with bytes count instead of char count. [ticket:1808]
2010-05-27 13:02:17 -04:00
Mike Bayer 6033b07409 - Columns of _Binary type (i.e. LargeBinary, BLOB, etc.)
will coerce a "basestring" on the right side into a
_Binary as well so that required DBAPI processing
takes place.
2010-05-22 19:08:48 -04:00
Mike Bayer 0a8f2207f0 - func.XXX() doesn't inadvertently resolve to non-Function
classes (e.g. fixes func.text()).  [ticket:1798]
2010-05-13 15:26:53 -04:00
Mike Bayer 074ecc4376 - expr.in_() now accepts a text() construct as the argument.
Grouping parenthesis are added automatically, i.e. usage
is like `col.in_(text("select id from table"))`.
[ticket:1793]
2010-05-08 16:25:30 -04:00
Mike Bayer 7b86a06d2d - Fixed errant space character when generating ADD CONSTRAINT
for a named UNIQUE constraint.
2010-04-26 00:11:22 -04:00
Mike Bayer ae495c69ad - Fixed bug that prevented implicit RETURNING from functioning
properly with composite primary key that contained zeroes.
[ticket:1778]
2010-04-22 11:24:25 -04:00