Commit Graph

49 Commits

Author SHA1 Message Date
Jason Kirtland 04e8a839b4 MetaData can now reflect() all tables in the database en-masse thanks to table_names().
table_names changed to accept an explicit connection
ThreadLocalMetaData constructor now takes no arguments. If case_sensitive is needed in a multi-bind context, move it to Table or subclass TLMD to force it.
Banished **kwargs from MetaData
Lots of class doc and docstring improvements around MetaData and TLMD.
Some engine->bind internal naming updates + reorg in schema.
MySQL table_names now return Unicode. (Also, a unicode reflect() unit test is needed.)
2007-07-31 00:19:23 +00:00
Jonathan Ellis 47406ca924 test for table_names 2007-07-30 19:14:08 +00:00
Mike Bayer 9b1ccb29d4 clearer error for ForeignKey cant locate parent table, [ticket:565] 2007-07-29 02:26:42 +00:00
Mike Bayer 5b7363c338 - merged ants' derived attributes example from 0.4 branch
- disabled PG schema test for now (want to see the buildbot succeed)
2007-07-27 04:12:07 +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
Mike Bayer bdf8f4ca80 postgres cant do this particular test b.c. the default "public" schema is taken
as a blank "schema" argument on Table
2007-07-20 21:01:51 +00:00
Jason Kirtland 7fed906a9b Better quoting of identifiers when manipulating schemas
Merged from r2981
2007-07-19 20:44:19 +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
Jason Kirtland 23d0188749 - Added basic schema reflection coverage to main tests
- Fix stupid mysql typo (#662)
- Merged mysql osx/multibyte has_table from 0.4 (r2943)
2007-07-17 13:21:46 +00:00
Mike Bayer 3a9af19d14 - columns can be overridden in a reflected table with a "key"
attribute different than the column's name, including for primary key
columns [ticket:650]
- more docs
2007-07-15 04:50:11 +00:00
Paul Johnston 81fd0c8bb9 mssql now able to reflect start and increment values for identity columns 2007-07-11 17:58:45 +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 abd257eb8c - MetaData and all SchemaItems are safe to use with pickle. slow
table reflections can be dumped into a pickled file to be reused later.
Just reconnect the engine to the metadata after unpickling. [ticket:619]
2007-06-30 00:20:26 +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
Mike Bayer cbc33de2fe pg test wasnt really working with that particular default..its a TODO 2007-06-02 20:33:15 +00:00
Jason Kirtland 0a713f408d - Emit BOOL rather than BOOLEAN for MySQL booleans in DDL, for old versions
of MySQL (#583)
- MySQL columns (such as times) with colons in their default values couldn't
  be roundtripped, fixed  (also in Postgres, but not fixed here.)
- BINARY/VARBINARY columns aren't really binary at all on ancient versions
  of MySQL.  The type.Binary(123) passthrough now always makes BLOBs.
  Removed the short-lived MSBaseBinary.
- Added mysql.get_version_info, given a connectable returns a tuple of server
  version info.
- Backed off on the reflection tests for older versions of MySQL, for now.
2007-05-31 22:56:24 +00:00
Mike Bayer 4004bf6a0a normalized PG test schema name to "alt_schema" 2007-05-26 19:51:35 +00:00
Jason Kirtland 5b8e4947d7 - Setup/teardown out test table properly 2007-05-25 22:32:34 +00:00
Mike Bayer 73732b8a80 - some cleanup of reflection unit tests
- removed silly behavior where sqlite would reflect UNIQUE indexes
as part of the primary key (?!)
- added __contains__ support to ColumnCollection; contains_column() method should be removed
2007-04-04 23:06:39 +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
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 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 b59f4d1a4a restored sequence back, needed by PG for the unit test 2007-02-22 03:51:21 +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 2019974544 - fixes to tometadata() operation to propigate Constraints at column and table level 2007-02-17 19:08:36 +00:00
Mike Bayer ffc7dbdae6 make sure auto-reflection of remote tables working too... 2007-02-04 23:52:21 +00:00
Mike Bayer e3b409f683 - added "schema" argument to all has_table() calls, only supported so far by PG
- added basic unit test for PG reflection of tables in an alternate schema
2007-02-04 23:45:45 +00:00
Mike Bayer d56a50eb70 - support for None as precision/length in numeric types for postgres, sqlite, mysql
- postgres reflection fixes: [ticket:349] [ticket:382]
2006-12-09 03:21:18 +00:00
Mike Bayer 892a1ebcb8 fixed pg reflection of timezones 2006-10-20 20:49:16 +00:00
Mike Bayer a941dff48f fix for sqlite refection of names with weird quotes around them in the DDL which seem to hang around 2006-10-19 23:01:14 +00:00
Mike Bayer 8340006dd7 - a fair amount of cleanup to the schema package, removal of ambiguous
methods, methods that are no longer needed.  slightly more constrained
useage, greater emphasis on explicitness.
- table_iterator signature fixup, includes fix for [ticket:288]
- the "primary_key" attribute of Table and other selectables becomes
a setlike ColumnCollection object; is no longer ordered or numerically
indexed.  a comparison clause between two pks that are derived from the
same underlying tables (i.e. such as two Alias objects) can be generated
via table1.primary_key==table2.primary_key
- append_item() methods removed from Table and Column; preferably
construct Table/Column/related objects inline, but if needed use
append_column(), append_foreign_key(), append_constraint(), etc.
- table.create() no longer returns the Table object, instead has no
return value.  the usual case is that tables are created via metadata,
which is preferable since it will handle table dependencies.
- added UniqueConstraint (goes at Table level), CheckConstraint
(goes at Table or Column level) fixes [ticket:217]
- index=False/unique=True on Column now creates a UniqueConstraint,
index=True/unique=False creates a plain Index,
index=True/unique=True on Column creates a unique Index.  'index'
and 'unique' keyword arguments to column are now boolean only; for
explcit names and groupings of indexes or unique constraints, use the
UniqueConstraint/Index constructs explicitly.
- relationship of Metadata/Table/SchemaGenerator/Dropper has been
improved so that the schemavisitor receives the metadata object
for greater control over groupings of creates/drops.
- added "use_alter" argument to ForeignKey, ForeignKeyConstraint,
but it doesnt do anything yet.  will utilize new generator/dropper
behavior to implement.
2006-10-14 21:58:04 +00:00
Mike Bayer 51f16d1498 - the "foreign_key" attribute on Column and ColumnElement in general
is deprecated, in favor of the "foreign_keys" list/set-based attribute,
    which takes into account multiple foreign keys on one column.
    "foreign_key" will return the first element in the "foreign_keys" list/set
    or None if the list is empty.
- added a user test to the relationships test, testing various new things this
change allows
2006-10-08 02:46:40 +00:00
Mike Bayer 8a1706b494 - fixed condition that occurred during reflection when a primary key
column was explciitly overridden, where the PrimaryKeyConstraint would
    get both the reflected and the programmatic column doubled up
2006-09-30 16:26:52 +00:00
Mike Bayer 7b82393355 sequence/default adjustments to allow postgres 8.1 tests to function 2006-08-31 23:33:55 +00:00
Mike Bayer d0a3313edf - postgres reflection moved to use pg_schema tables, can be overridden
with use_information_schema=True argument to create_engine
[ticket:60], [ticket:71]
- added natural_case argument to Table, Column, semi-experimental
flag for use with table reflection to help with quoting rules
[ticket:155]
2006-08-21 00:37:34 +00:00
Mike Bayer bd04cffad8 more fixes for [ticket:269], added MSMediumBlob type 2006-08-18 00:49:57 +00:00
Mike Bayer 698725a1a9 [ticket:277] check if pg/oracle sequence exists. checks in all cases before CREATE SEQUENCE/ DROP SEQUENCE 2006-08-16 19:48:24 +00:00
Mike Bayer 26efe4f643 fixes to types so that database-specific types more easily used;
fixes to mysql text types to work with this methodology
[ticket:269]
2006-08-12 19:50:07 +00:00
Mike Bayer 4e033e73f3 turned off default case-folding rules as they wreak havoc with the current unittests,
temporary isintance() checks in ASNIIdentifierPreparer which will be replaced with visit_
methodology
2006-08-12 17:53:04 +00:00
Mike Bayer aaefbb7e04 - better check for ambiguous join conditions in sql.Join; propigates to a
better error message in PropertyLoader (i.e. relation()/backref()) for when
the join condition can't be reasonably determined.
- sqlite creates ForeignKeyConstraint objects properly upon table
reflection.
2006-08-03 00:28:57 +00:00
Mike Bayer 946984d812 fixed reflection of foreign keys to autoload the referenced table
if it was not loaded already, affected postgres, mysql, oracle.
fixes the latest in [ticket:105]
2006-07-22 06:21:58 +00:00
Mike Bayer 934ac330ea added table.exists() 2006-07-19 22:20:49 +00:00
Mike Bayer 8b50115acc added 'checkfirst' argument to table.create()/table.drop()
some 0.2.6 prep
2006-07-19 22:13:29 +00:00
Mike Bayer bc6fbfa84a overhaul to schema, addition of ForeignKeyConstraint/
PrimaryKeyConstraint objects (also UniqueConstraint not
completed yet).  table creation and reflection modified
to be more oriented towards these new table-level objects.
reflection for sqlite/postgres/mysql supports composite
foreign keys; oracle/mssql/firebird not converted yet.
2006-07-14 20:06:09 +00:00
Mike Bayer b3927fbb88 inserting './lib/' into sys.path since PYTHONPATH no longer straightforward with latest setuptools 2006-06-29 00:28:55 +00:00
Mike Bayer f6718830bf unsupported unit test on mysql 2006-06-16 19:28:36 +00:00
Mike Bayer d37d8681e4 fixed bug where tables with schema name werent getting indexed in metadata correctly 2006-06-06 16:38:30 +00:00
Mike Bayer bdb41655d1 added "NonExistentTable" exception throw to reflection, courtesy lbruno@republico.estv.ipv.pt, for [ticket:138] 2006-06-06 00:11:54 +00:00
Mike Bayer 120dcee5a7 reorganized unit tests into subdirectories 2006-06-05 17:25:51 +00:00