airbytehq / airbytehq/PyAirbyte

Performance: Explore alternative to fetching all schemas in base.py

未關閉
#53 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
344
分支
77
平均合併
1 天 11 小時
30 天內合併 PR
35

描述

Since we already know the schema name, we could potentially check whether it exists rather than fetching all schemas and then comparing:
```
def _get_schemas_list(
self,
database_name: str | None = None,
) -> list[str]:
"""Return a list of all tables in the database."""
inspector: Inspector = sqlalchemy.inspect(self.get_sql_engine())
database_name = database_name or self.database_name
found_schemas = inspector.get_schema_names()
return [
found_schema.split(".")[-1].strip('"')
for found_schema in found_schemas
if "." not in found_schema
or (found_schema.split(".")[0].lower().strip('"') == database_name.lower())
]
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。