@@ -245,22 +245,42 @@ def get_indexes(self, connection, table_name, schema=None, **kw):
245245 return []
246246
247247 def get_table_names (self , connection , schema = None , ** kwargs ):
248- # TODO: Change this to ignore views!!!!!!!
249248 TABLE_NAME = 1
250249 catalog = "`" + self .catalog + "`"
250+ schema_str = schema
251251 schema = ("`" + schema + "`" ) or ("`" + self .schema + "`" )
252252
253253 with self .get_driver_connection (
254254 connection
255255 )._dbapi_connection .dbapi_connection .cursor () as cur :
256- sql_str = "SHOW TABLES FROM {}" .format (
257- "." .join ([catalog , schema ])
256+ sql_str = """SELECT table_schema, table_name
257+ FROM information_schema.tables
258+ WHERE table_schema = '{}'
259+ AND table_type = 'MANAGED';""" .format (
260+ schema_str
258261 )
259262 data = cur .execute (sql_str ).fetchall ()
260263 _tables = [i [TABLE_NAME ] for i in data ]
261264
262265 return _tables
263266
267+ # TODO: Commented out this until can be deleted after successful tests
268+ # def get_table_names(self, connection, schema=None, **kwargs):
269+ # TABLE_NAME = 1
270+ # catalog = "`" + self.catalog + "`"
271+ # schema = ("`" + schema + "`") or ("`" + self.schema + "`")
272+ #
273+ # with self.get_driver_connection(
274+ # connection
275+ # )._dbapi_connection.dbapi_connection.cursor() as cur:
276+ # sql_str = "SHOW TABLES FROM {}".format(
277+ # ".".join([catalog, schema])
278+ # )
279+ # data = cur.execute(sql_str).fetchall()
280+ # _tables = [i[TABLE_NAME] for i in data]
281+ #
282+ # return _tables
283+
264284 def get_view_names (self , connection , schema = None , ** kwargs ):
265285 VIEW_NAME = 1
266286 with self .get_driver_connection (
0 commit comments