(conn)
| 510 | |
| 511 | |
| 512 | def get_all_views(conn): |
| 513 | if isinstance(conn, sqlite3.Connection): |
| 514 | c = conn.execute("SELECT name FROM sqlite_master WHERE type='view'") |
| 515 | return [view[0] for view in c.fetchall()] |
| 516 | else: |
| 517 | adbc = import_optional_dependency("adbc_driver_manager.dbapi", errors="ignore") |
| 518 | if adbc and isinstance(conn, adbc.Connection): |
| 519 | results = [] |
| 520 | info = conn.adbc_get_objects().read_all().to_pylist() |
| 521 | for catalog in info: |
| 522 | catalog["catalog_name"] |
| 523 | for schema in catalog["catalog_db_schemas"]: |
| 524 | schema["db_schema_name"] |
| 525 | for table in schema["db_schema_tables"]: |
| 526 | if table["table_type"] == "view": |
| 527 | view_name = table["table_name"] |
| 528 | results.append(view_name) |
| 529 | |
| 530 | return results |
| 531 | else: |
| 532 | from sqlalchemy import inspect |
| 533 | |
| 534 | return inspect(conn).get_view_names() |
| 535 | |
| 536 | |
| 537 | def get_all_tables(conn): |
no test coverage detected