Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
milicevica23 committed Mar 4, 2024
1 parent 0b304c0 commit a064f9c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
8 changes: 4 additions & 4 deletions dbt/adapters/duckdb/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def configure_connection(self, conn: DuckDBPyConnection):
"""
pass

# coursor is needed for the native plugin
def load(self, source_config: SourceConfig, coursor=None):
# cursor is needed for the native plugin
def load(self, source_config: SourceConfig, cursor=None):
"""
Load data from a source config and return it as a DataFrame-like object
that DuckDB can read. This method should be overridden by subclasses that
Expand All @@ -123,13 +123,13 @@ def load(self, source_config: SourceConfig, coursor=None):
"""
raise NotImplementedError(f"load method not implemented for {self.name}")

# coursor is needed just for the native, we have to do it better
# cursor is needed just for the native, we have to do it better
# to had it over in some initalization?
def store(self, df: DuckDBPyRelation, target_config: TargetConfig, cursor=None):
raise NotImplementedError(f"store method not implemented for {self.name}")

def create_source_config(self, target_config: TargetConfig) -> SourceConfig:
raise NotImplementedError(f"store method not implemented for {self.name}")
raise NotImplementedError(f"create_source_config method not implemented for {self.name}")

def can_be_upstream_referenced(self):
return False
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/duckdb/plugins/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(self, config: Dict[str, Any]):
def configure_cursor(self, cursor):
pass

def load(self, source_config: SourceConfig, coursor=None):
def load(self, source_config: SourceConfig, cursor=None):
if "delta_table_path" not in source_config:
raise Exception("'delta_table_path' is a required argument for the delta table!")

Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/duckdb/plugins/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(self, plugin_config: Dict[str, Any]):
if "s3_region" in plugin_config:
os.environ["AWS_DEFAULT_REGION"] = plugin_config["s3_region"]

def load(self, source_config: SourceConfig, coursor=None):
def load(self, source_config: SourceConfig, cursor=None):
ext_location = source_config["external_location"]
ext_location = ext_location.format(**source_config.as_dict())
if "s3" in ext_location:
Expand Down Expand Up @@ -95,7 +95,7 @@ def store(self, df: DuckDBPyRelation, target_config: TargetConfig, cursor=None):

def create_source_config(self, target_config: TargetConfig) -> SourceConfig:
# in the reader we have just location and sheet_name, maybe we can add here more options
# but in the first place i would not recommend to upstream excel file
# but in the first place i would not recommend to downstream excel file
# this works for a very simple case but not all of them
meta = {
"external_location": target_config.location.path,
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/duckdb/plugins/gsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize(self, config: Dict[str, Any]):
self._config = GSheetConfig.from_dict(config)
self._gc = self._config.client()

def load(self, source_config: SourceConfig, coursor=None):
def load(self, source_config: SourceConfig, cursor=None):
doc = None
if "title" in source_config:
doc = self._gc.open(source_config["title"])
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/duckdb/plugins/iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(self, config: Dict[str, Any]):
catalog = config.pop("catalog")
self._catalog = pyiceberg.catalog.load_catalog(catalog, **config)

def load(self, source_config: SourceConfig, coursor=None):
def load(self, source_config: SourceConfig, cursor=None):
table_format = source_config.get("iceberg_table", "{schema}.{identifier}")
table_name = table_format.format(**source_config.as_dict())
table = self._catalog.load_table(table_name)
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/duckdb/plugins/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def default_materialization(self):

# this one can be better not to go over some other format and df but directly
# https://stackoverflow.com/questions/78055585/how-to-reference-duckdbpyrelation-from-another-connection
def load(self, source_config: SourceConfig, coursor=None):
def load(self, source_config: SourceConfig, cursor=None):
location = external_read_location(
source_config.meta.get("location", "").get("path"),
source_config.meta.get("config", {}).get("options", {}),
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/duckdb/plugins/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Plugin(BasePlugin):
def initialize(self, plugin_config: Dict[str, Any]):
self.engine = create_engine(plugin_config.pop("connection_url"), **plugin_config)

def load(self, source_config: SourceConfig, coursor=None):
def load(self, source_config: SourceConfig, cursor=None):
if "query" in source_config:
query = source_config["query"]
query = query.format(**source_config.as_dict())
Expand Down
19 changes: 9 additions & 10 deletions tests/create_function_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ class Plugin(BasePlugin):
def configure_connection(self, conn: DuckDBPyConnection):
conn.create_function("foo", foo)

def store(self, df: DuckDBPyRelation, target_config: TargetConfig, cursor = None):
def store(self, df: DuckDBPyRelation, target_config: TargetConfig, cursor=None):
assert target_config.config.get("key") == "value"

def can_be_upstream_referenced(self):
return True

def load(self, source_config: SourceConfig, coursor = None):


def load(self, source_config: SourceConfig, cursor=None):
return duckdb.sql("SELECT 1729 as foo").arrow()

def create_source_config(self, target_config: TargetConfig) -> SourceConfig:
source_config = SourceConfig(
name= target_config.relation.name,
identifier= target_config.relation.identifier,
name=target_config.relation.name,
identifier=target_config.relation.identifier,
schema=target_config.relation.schema,
database=target_config.relation.database,
meta= target_config.as_dict(),
tags= [],
meta=target_config.as_dict(),
tags=[],
)
return source_config
return source_config

0 comments on commit a064f9c

Please sign in to comment.