Skip to content

Commit

Permalink
chore: change property database to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos314 committed Aug 22, 2024
1 parent 488e3f1 commit 028c21e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ TARGET_ICEBERG_CREDENTIAL=
TARGET_ICEBERG_CATALOG_URI=
TARGET_ICEBERG_WAREHOUSE=
TARGET_ICEBERG_CATALOG_TYPE=
TARGET_ICEBERG_DATABASE=
TARGET_ICEBERG_NAMESPACE=
TARGET_ICEBERG_S3_ENDPOINT=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipx install git+https://github.com/ORG_NAME/target-iceberg.git@main
| catalog_uri | True | None | Catalog URI, e.g. https://api.catalog.io/ws/ |
| warehouse | True | None | The name of the catalog where data will be written |
| catalog_type | True | None | rest or jdbc |
| database | True | None | The name of the database where data will be written |
| namespace | True | None | The namespace where data will be written|
| add_record_metadata | False | None | Add metadata to records. |
| validate_records | False | 1 | Whether to validate the schema of the incoming streams. |
| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). |
Expand Down
4 changes: 2 additions & 2 deletions meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ plugins:
- name: warehouse
- name: catalog_uri
- name: credential
- name: database
- name: namespace
- name: s3_access_key_id
- name: s3_secret_access_key
- name: s3_endpoint

settings_group_validation:
- [catalog_type,warehouse,database]
- [catalog_type,warehouse,namespace]
4 changes: 2 additions & 2 deletions target_iceberg/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def process_batch(self, context: dict) -> None:

if context.get("records"):

if table := catalog.load_table(f"{self.config['database']}.{self.stream_name}"):
if table := catalog.load_table(f"{self.config['namespace']}.{self.stream_name}"):

logger.info(
"Appending to table", extra={"table_name": self.stream_name}
Expand All @@ -61,5 +61,5 @@ def process_batch(self, context: dict) -> None:
table.append(records)

else:
msg = f"Table {self.stream_name} should exist in database"
msg = f"Table {self.stream_name} should exist in namespace"
raise ValueError(msg)
4 changes: 2 additions & 2 deletions target_iceberg/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class TargetIceberg(Target):
required=True,
),
th.Property(
"database",
"namespace",
th.StringType,
description="The name of the database where data will be written",
description="The namespace where data will be written",
required=True,
),
).to_dict()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"catalog_uri": "http://localhost:8181",
"warehouse": "demo",
"catalog_type": "rest",
"database": uuid.uuid4().hex,
"namespace": uuid.uuid4().hex,
"s3_endpoint": "http://localhost:9000",
"s3_access_key_id": "admin",
"s3_secret_access_key": "password",
Expand Down Expand Up @@ -134,7 +134,7 @@ def test(self) -> None:
"""Run partitioning test."""
self.runner.sync_all()

table = catalog.load_table(f"{SAMPLE_CONFIG['database']}.data_partitioning")
table = catalog.load_table(f"{SAMPLE_CONFIG['namespace']}.data_partitioning")
number_of_partitions = len(table.inspect.partitions())

"""In data_partitioning.singer, we currently have only three distinct fields available for partitioning"""
Expand Down Expand Up @@ -168,7 +168,7 @@ def resource(self): # noqa: ANN201
for table, schema in REQUIRED_TABLES.items():

table_creation_config = {
"identifier": f"{SAMPLE_CONFIG['database']}.{table}",
"identifier": f"{SAMPLE_CONFIG['namespace']}.{table}",
"schema": schema,
}

Expand Down

0 comments on commit 028c21e

Please sign in to comment.