self._set_parent(metadata)
+ self.quote = kwargs.pop('quote', None)
+ self.quote_schema = kwargs.pop('quote_schema', None)
+ if kwargs.get('info'):
+ self._info = kwargs.pop('info')
+
self.__extra_kwargs(**kwargs)
# load column definitions from the database if 'autoload' is defined
if c.name not in include_columns:
self.c.remove(c)
+ for key in ('quote', 'quote_schema'):
+ if key in kwargs:
+ setattr(self, key, kwargs.pop(key))
+
+ if 'info' in kwargs:
+ self._info = kwargs.pop('info')
+
self.__extra_kwargs(**kwargs)
self.__post_init(*args, **kwargs)
['autoload', 'autoload_with', 'schema', 'owner']))
def __extra_kwargs(self, **kwargs):
- self.quote = kwargs.pop('quote', None)
- self.quote_schema = kwargs.pop('quote_schema', None)
- if kwargs.get('info'):
- self._info = kwargs.pop('info')
-
# validate remaining kwargs that they all specify DB prefixes
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()))
self.kwargs.update(kwargs)
-
def __post_init(self, *args, **kwargs):
self._init_items(*args)
Column('ColumnOne', Integer, quote=False), quote=False, schema="FooBar", quote_schema=False)
self.assert_compile(t1.select(), '''SELECT FooBar.TableOne.ColumnOne FROM FooBar.TableOne''')
+ def test_table_quote_flag(self):
+ metadata = MetaData()
+ t1 = Table('TableOne', metadata,
+ Column('id', Integer),
+ quote=False)
+ t2 = Table('TableTwo', metadata,
+ Column('id', Integer),
+ Column('t1_id', Integer, ForeignKey('TableOne.id')),
+ quote=False)
+
+ self.assert_compile(
+ t2.join(t1).select(),
+ "SELECT TableTwo.id, TableTwo.t1_id, TableOne.id "
+ "FROM TableTwo JOIN TableOne ON TableOne.id = TableTwo.t1_id")
+
@testing.crashes('oracle', 'FIXME: unknown, verify not fails_on')
@testing.requires.subqueries
def testlabels(self):