Commit Graph

624 Commits

Author SHA1 Message Date
Mike Bayer 12073e281e - SchemaItem, SchemaType now descend from common type
SchemaEventTarget, which supplies dispatch
- the dispatch now provides before_parent_attach(),
after_parent_attach(), events which generally bound the _set_parent()
event. [ticket:2037]
- the _on_table_attach mechanism now usually uses the
event dispatch
- fixed class-level event dispatch to propagate to all subclasses, not just
immediate subclasses
- fixed class-level event unpickling to handle more involved
inheritance hierarchies, needed by the new schema event dispatch.
- ForeignKeyConstraint doesn't re-call the column attach event
on ForeignKey objects that are already associated with the correct
Column
- we still need that ImportError on mysqldb CLIENT FLAGS to support
mock DBAPIs
2011-01-30 20:29:48 -05:00
Mike Bayer 1c1ff92fa9 - Column.copy(), as used in table.tometadata(), copies the
'doc' attribute.  [ticket:2028]
2011-01-30 13:09:45 -05:00
Mike Bayer 1515073b96 - New DBAPI support for pymysql, a pure Python port
of MySQL-python.  [ticket:1991]
2011-01-26 11:18:03 -05:00
Mike Bayer 9122268ed0 - new dialect for Drizzle [ticket:2003]
- move mysqldb to a connector, can be shared among mysql/drizzle
2011-01-26 10:44:00 -05:00
Mike Bayer 3ac7ec476e - fix oracle tests
- fix some obnoxious type adaption issues resulting from the "adapt must copy" change
2011-01-25 22:37:18 -05:00
Mike Bayer aedd34f34f Regarding reflection for this case, reflection of an int PK col
with a server_default sets the "autoincrement" flag to False,
except in the case of a PG SERIAL col where we detected a
sequence default. [ticket:2020] [ticket:2021]
2011-01-15 16:50:52 -05:00
Mike Bayer dff5a404e4 - getting slightly more consistent behavior for the edge case of pk columns
with server default - autoincrement is now false with any server_default,
so these all return None, applies consistency to [ticket:2020], [ticket:2021].
if prefetch is desired a "default" should be used instead of server_default.
2011-01-15 16:42:29 -05:00
Mike Bayer 0f31f36fe5 - dont count server_default absense as part of autoincrement, PG
will have a value here upon reflection.
- mysql, others will have to check "server_default" when rendering
special keywords like AUTOINCREMENT
2011-01-12 15:49:59 -05:00
Mike Bayer 67e0f356b2 - A TypeDecorator of Integer can be used with a primary key
column, and the "autoincrement" feature of various dialects
  as well as the "sqlite_autoincrement" flag will honor
  the underlying database type as being Integer-based.
 [ticket:2005]

- Result-row processors are applied to pre-executed SQL
  defaults, as well as cursor.lastrowid, when determining
  the contents of result.inserted_primary_key.
  [ticket:2006]

- Bind parameters present in the "columns clause" of a select
  are now auto-labeled like other "anonymous" clauses,
  which among other things allows their "type" to be meaningful
  when the row is fetched, as in result row processors.

- TypeDecorator is present in the "sqlalchemy" import space.
2011-01-11 15:22:46 -05:00
Mike Bayer 4e9e0f041c - merge r43460573c27a:4993c7eae8e5d117ff342bdc59f3b0635b898e2c of 0.6 branch 2011-01-08 16:14:47 -05:00
Mike Bayer e46301b515 - The Index() construct can be created inline with a Table
definition, using strings as column names, as an alternative
to the creation of the index outside of the Table.
2011-01-04 13:48:46 -05:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Michael Trier c0ddbf502f Ridding the world of a few wasteful imports. 2010-12-19 23:16:50 -05:00
Michael Trier 650bbcc8fd merge tip 2010-12-19 19:38:03 -05:00
Michael Trier 15ea17d7f8 Added NULLS FIRST and NULLS LAST support.
It's implemented as an extension to the asc() and desc() operators, called
nullsfirst() and nullslast().  [ticket:723]
2010-12-19 19:25:33 -05:00
Mike Bayer 2e7a54d6fb merge tip 2010-12-17 14:19:22 -05:00
Mike Bayer 50bc970a33 arg, fix again 2010-12-15 17:19:48 -05:00
Mike Bayer 1f0e7a6120 - fix broken py3k block 2010-12-15 13:25:16 -05:00
Mike Bayer b5f3648188 merge tip 2010-12-15 12:46:21 -05:00
Mike Bayer 77649e6748 - 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 bfaa97dbce some tests, should be OK 2010-12-13 20:23:24 -05:00
Mike Bayer c691b4cbdf - support for cdecimal
- add --with-cdecimal flag to tests, monkeypatches cdecimal in
- fix mssql/pyodbc.py to not use private '_int' accessor in decimal conversion
routines
- pyodbc version 2.1.8 is needed for cdecimal in any case as
previous versions also called '_int', 2.1.8 adds the same string
logic as our own dialect, so that logic is skipped for modern
pyodbc version
- make the imports for "Decimal" consistent across the whole lib.  not sure
yet how we should be importing "Decimal" or what the best way forward
is that would allow a clean user-invoked swap of cdecimal; for now,
added docs suggesting a global monkeypatch - the two decimal libs
are not compatible with each other so any chance of mixing produces
serious issues.  adding adapters to DBAPIs tedious and adds in-python
overhead.  suggestions welcome on how we should be doing
Decimal/cdecimal.
2010-12-11 17:44:46 -05:00
Mike Bayer 66e5de30f2 - initial stab at using executemany() for inserts in the ORM when possible 2010-12-10 21:38:46 -05:00
Mike Bayer 1ea2ac1261 add oursql to the list of offenders... 2010-12-08 15:00:37 -05:00
Mike Bayer 9d5d0bbd83 - add test coverage for what DBAPIs give us raw for numerics 2010-12-08 14:31:45 -05:00
Mike Bayer f1e54a69fb - merge default tip 2010-12-05 14:56:26 -05:00
Mike Bayer 8e24584d8d - ResultProxy and friends always reference the DBAPI connection at the same time
as the cursor.  There is no reason for CursorFairy - the only use case would be,
end-user is using the pool or pool.manage with DBAPI connections, uses a cursor,
deferences the owning connection and continues using cursor.  This is an almost
nonexistent use case and isn't correct usage at a DBAPI level.  Take out CursorFairy.
- move the "check for a dot in the colname" logic out to the sqlite dialect.
2010-12-05 00:46:11 -05:00
Mike Bayer 71083b6977 combine test/engine/test_metadata.py and test/sql/test_columns.py into new
test/sql/test_metadata.py, [ticket:1970]
2010-11-28 15:34:41 -05:00
Mike Bayer 58b2939433 - sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".

Rationale:

- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options

[ticket:1949]
2010-11-28 14:19:44 -05:00
Mike Bayer 59a177a4c0 - _literal_as_text raises if the incoming arg is not a Visitable or basestring.
[ticket:1847]
2010-11-28 11:24:57 -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 ea55a4644c - bindparam() gets a new option "callable", which is a lambda or def
evaluated at execution time to determine the value.  This replaces
the implicit recognition of callables sent as the primary value
of bindparam(), which was an undocumented behavior used by the ORM.
The argument is separated now so that values can be passed to
bindparams that are also callables without ambiguity, such
as user defined objects that include a __call__() method.
[ticket:1950]
2010-11-20 15:43:12 -05:00
Mike Bayer e3ca3a773f - merge FromObj cleanup, immutable .c attribute patch, [ticket:1917] 2010-11-20 15:35:43 -05:00
Mike Bayer 041a329e69 - adapt initial patch from [ticket:1917] to current tip
- raise TypeError for immutability
2010-11-16 15:53:14 -05:00
Mike Bayer e1402efb19 - move sqlalchemy.test to test.lib 2010-11-15 19:37:50 -05:00
Mike Bayer 6fb06409c6 merge tip 2010-11-14 18:25: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 90c8d8e0c9 merge tip 2010-09-19 16:11:16 -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 e4bc7d2894 - move LIMIT/OFFSET rendering to be as bind parameters, for all backends
which support it.  This includes SQLite, MySQL, Postgresql, Firebird,
Oracle (already used binds with ROW NUMBER OVER), MSSQL (when ROW NUMBER
is used, not TOP).   Not included are Informix, Sybase, MaxDB, Access
[ticket:805]
- LIMIT/OFFSET parameters need to stay as literals within SQL
constructs.  This because they may not be renderable as binds on
some backends.
2010-08-29 16:35:02 -04:00