Skip to content

Commit a163e26

Browse files
author
Peng Ren
committed
Fix bug for superset
1 parent c587cc8 commit a163e26

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

pymongosql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if TYPE_CHECKING:
77
from .connection import Connection
88

9-
__version__: str = "0.2.0"
9+
__version__: str = "0.2.1"
1010

1111
# Globals https://www.python.org/dev/peps/pep-0249/#globals
1212
apilevel: str = "2.0"

pymongosql/sqlalchemy_mongodb/sqlalchemy_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
# -*- coding: utf-8 -*-
22
"""
33
SQLAlchemy version compatibility utilities for PyMongoSQL.
44

pymongosql/sqlalchemy_mongodb/sqlalchemy_dialect.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,24 @@ def get_table_names(self, connection, schema: Optional[str] = None, **kwargs) ->
324324
_logger.warning(f"Failed to get table names: {e}")
325325
return []
326326

327+
def get_view_names(self, connection, schema: Optional[str] = None, **kwargs) -> List[str]:
328+
"""Get list of views.
329+
330+
MongoDB doesn't have traditional SQL views like relational databases.
331+
Return empty list to satisfy SQLAlchemy and tools like Superset.
332+
333+
Args:
334+
connection: Database connection
335+
schema: Optional schema/database name
336+
**kwargs: Additional arguments
337+
338+
Returns:
339+
Empty list as MongoDB doesn't support SQL views
340+
"""
341+
# MongoDB doesn't have traditional SQL views
342+
# Return empty list to avoid NotImplementedError
343+
return []
344+
327345
def get_columns(self, connection, table_name: str, schema: Optional[str] = None, **kwargs) -> List[Dict[str, Any]]:
328346
"""Get column information for a collection.
329347

0 commit comments

Comments
 (0)