def get_columns(self, connection, table_name, schema=None, **kw):
current_schema = self.denormalize_name(schema or self.default_schema_name)
table_name = self.denormalize_name(table_name)
syscols = self.sys_columns
query = select(
[
syscols.c.colname,
syscols.c.typename,
syscols.c.defaultval,
syscols.c.nullable,
syscols.c.length,
syscols.c.scale,
syscols.c.isid,
syscols.c.idgenerate,
],
and_(
syscols.c.tabschema == current_schema, syscols.c.tabname == table_name
),
order_by=[syscols.c.colno],
)
sa_columns = []
for row in connection.execute(query):
coltype = row[1].upper()
if coltype in ["DECIMAL", "NUMERIC"]:
coltype = self.ischema_names.get(coltype)(
precision=int(row[4]), scale=int(row[5])
)
elif coltype in ["CHARACTER", "CHAR", "VARCHAR", "GRAPHIC", "VARGRAPHIC"]:
coltype = self.ischema_names.get(coltype)(length=int(row[4]))
else:
try:
coltype = self.ischema_names[coltype]
except KeyError:
util.warn(
"Did not recognize type '%s' of column '%s'" % (coltype, row[0])
)
coltype = sa_types.NULLTYPE
sa_columns.append(
{
"name": self.normalize_name(row[0]),
"type": coltype,
"nullable": row[3] == "Y",
"default": row[2],
"autoincrement": (row[6] == "YES") and (row[7] is not None),
}
)
return sa_columns
IBM does not support some data types for DB2, can these lead to problems?
Error message:
"base.py:1288: SAWarning: Did not recognize type 'TIMESTMP' of column 'PXXX_DATE'"
Program code: