mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-18 06:06:55 +00:00
fix(ingest) Athena: db filter was not applied (#4127)
* Fix for db filter on Athena * Black formatting * Addressing pr comments * Remove unneeded imports
This commit is contained in:
parent
7fcc71ed81
commit
d24c52828b
@ -1,4 +1,7 @@
|
||||
from typing import Optional
|
||||
import typing
|
||||
from typing import List, Optional
|
||||
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
|
||||
from datahub.ingestion.source.sql.sql_common import (
|
||||
SQLAlchemyConfig,
|
||||
@ -40,3 +43,11 @@ class AthenaSource(SQLAlchemySource):
|
||||
def create(cls, config_dict, ctx):
|
||||
config = AthenaConfig.parse_obj(config_dict)
|
||||
return cls(config, ctx)
|
||||
|
||||
# It seems like database/schema filter in the connection string does not work and this to work around that
|
||||
def get_schema_names(self, inspector: Inspector) -> List[str]:
|
||||
athena_config = typing.cast(AthenaConfig, self.config)
|
||||
schemas = inspector.get_schema_names()
|
||||
if athena_config.database:
|
||||
return [schema for schema in schemas if schema == athena_config.database]
|
||||
return schemas
|
||||
|
Loading…
x
Reference in New Issue
Block a user