[external-metadata] Fix unknown column types (#6196)

This commit is contained in:
John Bodley 2018-10-25 18:56:24 -07:00 committed by GitHub
parent a0479d57b2
commit 71db0736be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ from sqlalchemy import (
and_, asc, Boolean, Column, DateTime, desc, ForeignKey, Integer, or_,
select, String, Text,
)
from sqlalchemy.exc import CompileError
from sqlalchemy.orm import backref, relationship
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.sql import column, literal_column, table, text
@ -377,7 +378,10 @@ class SqlaTable(Model, BaseDatasource):
def external_metadata(self):
cols = self.database.get_columns(self.table_name, schema=self.schema)
for col in cols:
col['type'] = '{}'.format(col['type'])
try:
col['type'] = str(col['type'])
except CompileError:
col['type'] = 'UNKNOWN'
return cols
@property