TIMESTAMP WITH TIME ZONE, i.e. TIMESTAMP(timezone=True).
[ticket:651]
- Oracle INTERVAL type can now be reflected.
which is more or less equivalent on that platform.
[ticket:1712]
+ - Added support for rendering and reflecting
+ TIMESTAMP WITH TIME ZONE, i.e. TIMESTAMP(timezone=True).
+ [ticket:651]
+
+ - Oracle INTERVAL type can now be reflected.
+
- sqlite
- Added "native_datetime=True" flag to create_engine().
This will cause the DATE and TIMESTAMP types to skip
'CLOB' : CLOB,
'NCLOB' : NCLOB,
'TIMESTAMP' : TIMESTAMP,
+ 'TIMESTAMP WITH TIME ZONE' : TIMESTAMP,
+ 'INTERVAL DAY TO SECOND' : INTERVAL,
'RAW' : RAW,
'FLOAT' : FLOAT,
'DOUBLE PRECISION' : DOUBLE_PRECISION,
"(%d)" % type_.second_precision or
"",
)
-
+
+ def visit_TIMESTAMP(self, type_):
+ if type_.timezone:
+ return "TIMESTAMP WITH TIME ZONE"
+ else:
+ return "TIMESTAMP"
+
def visit_DOUBLE_PRECISION(self, type_):
return self._generate_numeric(type_, "DOUBLE PRECISION")
coltype = NUMBER(precision, scale)
elif coltype=='CHAR' or coltype=='VARCHAR2':
coltype = self.ischema_names.get(coltype)(length)
+ elif 'WITH TIME ZONE' in coltype:
+ coltype = TIMESTAMP(timezone=True)
else:
coltype = re.sub(r'\(\d+\)', '', coltype)
try:
finally:
t1.drop()
-
+ def test_reflect_dates(self):
+ metadata = MetaData(testing.db)
+ Table(
+ "date_types", metadata,
+ Column('d1', DATE),
+ Column('d2', TIMESTAMP),
+ Column('d3', TIMESTAMP(timezone=True)),
+ Column('d4', oracle.INTERVAL(second_precision=5)),
+ )
+ metadata.create_all()
+ try:
+ m = MetaData(testing.db)
+ t1 = Table(
+ "date_types", m,
+ autoload=True)
+ assert isinstance(t1.c.d1.type, DATE)
+ assert isinstance(t1.c.d2.type, TIMESTAMP)
+ assert not t1.c.d2.type.timezone
+ assert isinstance(t1.c.d3.type, TIMESTAMP)
+ assert t1.c.d3.type.timezone
+ assert isinstance(t1.c.d4.type, oracle.INTERVAL)
+
+ finally:
+ metadata.drop_all()
+
def test_reflect_raw(self):
types_table = Table(
'all_types', MetaData(testing.db),