diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-08-12 17:28:15 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-08-12 17:28:15 +0000 |
| commit | 9e8fad2abcce364253352f042836bf58ce8f4f81 (patch) | |
| tree | 5058c15280a2e56d454670deeb7a53dd8b6b1f67 /lib/sqlalchemy/schema.py | |
| parent | fb88b031d916ea91ce9af760a67ea27e00113c14 (diff) | |
| download | sqlalchemy-9e8fad2abcce364253352f042836bf58ce8f4f81.tar.gz | |
quoting facilities set up so that database-specific quoting can be
turned on for individual table, schema, and column identifiers when
used in all queries/creates/drops. Enabled via "quote=True" in
Table or Column, as well as "quote_schema=True" in Table. Thanks to
Aaron Spike for his excellent efforts. [ticket:155]
Diffstat (limited to 'lib/sqlalchemy/schema.py')
| -rw-r--r-- | lib/sqlalchemy/schema.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 8577b24e1..bba73ef88 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -142,6 +142,12 @@ class Table(SchemaItem, sql.TableClause): owner=None : optional owning user of this table. useful for databases such as Oracle to aid in table reflection. + + quote=False : indicates that the Table identifier must be properly escaped and quoted before being sent + to the database. + + quote_schema=False : indicates that the Namespace identifier must be properly escaped and quoted before being sent + to the database. """ super(Table, self).__init__(name) self._metadata = metadata @@ -155,6 +161,8 @@ class Table(SchemaItem, sql.TableClause): else: self.fullname = self.name self.owner = kwargs.pop('owner', None) + self.quote = kwargs.pop('quote', False) + self.quote_schema = kwargs.pop('quote_schema', False) self.kwargs = kwargs def _set_primary_key(self, pk): @@ -322,6 +330,8 @@ class Column(SchemaItem, sql.ColumnClause): specify the same index name will all be included in the index, in the order of their creation. + quote=False : indicates that the Column identifier must be properly escaped and quoted before being sent + to the database. """ name = str(name) # in case of incoming unicode super(Column, self).__init__(name, None, type) @@ -333,6 +343,7 @@ class Column(SchemaItem, sql.ColumnClause): self.default = kwargs.pop('default', None) self.index = kwargs.pop('index', None) self.unique = kwargs.pop('unique', None) + self.quote = kwargs.pop('quote', False) self.onupdate = kwargs.pop('onupdate', None) if self.index is not None and self.unique is not None: raise exceptions.ArgumentError("Column may not define both index and unique") |
