Skip to content

Commit 9c3b47a

Browse files
committed
Add "get_view_names" to SQLAlchemy dialect
1 parent af8e256 commit 9c3b47a

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
@@ -246,6 +246,15 @@ def get_table_names(self, connection, schema=None, **kw):
246246
)
247247
return [row[0] for row in cursor.fetchall()]
248248

249+
@reflection.cache
250+
def get_view_names(self, connection, schema=None, **kw):
251+
cursor = connection.execute(
252+
"SELECT table_name FROM information_schema.views "
253+
"ORDER BY table_name ASC, {0} ASC".format(self.schema_column),
254+
[schema or self.default_schema_name]
255+
)
256+
return [row[0] for row in cursor.fetchall()]
257+
249258
@reflection.cache
250259
def get_columns(self, connection, table_name, schema=None, **kw):
251260
query = "SELECT column_name, data_type " \

0 commit comments

Comments
 (0)