Skip to content

Commit 1d9e151

Browse files
committed
SA14: Add get_view_names method to SQLAlchemy dialect
1 parent d64ecc9 commit 1d9e151

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/crate/client/sqlalchemy/dialect.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ def get_table_names(self, connection, schema=None, **kw):
237237
)
238238
return [row[0] for row in cursor.fetchall()]
239239

240+
@reflection.cache
241+
def get_view_names(self, connection, schema=None, **kw):
242+
cursor = connection.execute(
243+
"SELECT table_name FROM information_schema.views "
244+
"ORDER BY table_name ASC, {0} ASC".format(self.schema_column),
245+
[schema or self.default_schema_name]
246+
)
247+
return [row[0] for row in cursor.fetchall()]
248+
240249
@reflection.cache
241250
def get_columns(self, connection, table_name, schema=None, **kw):
242251
query = "SELECT column_name, data_type " \

0 commit comments

Comments
 (0)