Skip to content

Commit

Permalink
Add "get_view_names" to SQLAlchemy dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Dec 18, 2020
1 parent af8e256 commit 9c3b47a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/crate/client/sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ def get_table_names(self, connection, schema=None, **kw):
)
return [row[0] for row in cursor.fetchall()]

@reflection.cache
def get_view_names(self, connection, schema=None, **kw):
cursor = connection.execute(
"SELECT table_name FROM information_schema.views "
"ORDER BY table_name ASC, {0} ASC".format(self.schema_column),
[schema or self.default_schema_name]
)
return [row[0] for row in cursor.fetchall()]

@reflection.cache
def get_columns(self, connection, table_name, schema=None, **kw):
query = "SELECT column_name, data_type " \
Expand Down

0 comments on commit 9c3b47a

Please sign in to comment.