diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-11-26 02:36:27 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-11-26 02:36:27 +0000 |
commit | b6b0130646b677e507d2fb461829ed5d72658000 (patch) | |
tree | fe0acf9855ba4053cc7594e8e5b465721aad66c6 /lib/sqlalchemy/schema.py | |
parent | d9f3b2a06370a88676afa91ff3cd73722ad38543 (diff) | |
download | sqlalchemy-b6b0130646b677e507d2fb461829ed5d72658000.tar.gz |
- 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
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index d9a7684e7..8ebeaea27 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -14,7 +14,7 @@ structure with its own clause-specific objects as well as the visitor interface, the schema package "plugs in" to the SQL package. """ -from sqlalchemy import sql, types, exceptions,util +from sqlalchemy import sql, types, exceptions,util, databases import sqlalchemy import copy, re, string @@ -125,7 +125,7 @@ class _TableSingleton(type): table = metadata.tables[key] if len(args): if not useexisting: - raise exceptions.ArgumentError("Table '%s.%s' is already defined for this MetaData instance." % (schema, name)) + raise exceptions.ArgumentError("Table '%s' is already defined for this MetaData instance." % key) return table except KeyError: if mustexist: @@ -183,8 +183,7 @@ class Table(SchemaItem, sql.TableClause): else an exception is raised. useexisting=False : indicates that if this Table was already defined elsewhere in the application, disregard - the rest of the constructor arguments. If this flag and the "redefine" flag are not set, constructing - the same table twice will result in an exception. + the rest of the constructor arguments. owner=None : optional owning user of this table. useful for databases such as Oracle to aid in table reflection. @@ -207,8 +206,8 @@ class Table(SchemaItem, sql.TableClause): self.indexes = util.Set() self.constraints = util.Set() self.primary_key = PrimaryKeyConstraint() - self.quote = kwargs.get('quote', False) - self.quote_schema = kwargs.get('quote_schema', False) + self.quote = kwargs.pop('quote', False) + self.quote_schema = kwargs.pop('quote_schema', False) if self.schema is not None: self.fullname = "%s.%s" % (self.schema, self.name) else: @@ -217,8 +216,13 @@ class Table(SchemaItem, sql.TableClause): self._set_casing_strategy(name, kwargs) self._set_casing_strategy(self.schema or '', kwargs, keyname='case_sensitive_schema') + + if len([k for k in kwargs if not re.match(r'^(?:%s)_' % '|'.join(databases.__all__), k)]): + raise TypeError("Invalid argument(s) for Table: %s" % repr(kwargs.keys())) + + # store extra kwargs, which should only contain db-specific options self.kwargs = kwargs - + def _get_case_sensitive_schema(self): try: return getattr(self, '_case_sensitive_schema') |