Skip to content

Commit

Permalink
Chore: Fix Kinesis Lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Sep 2, 2024
1 parent ca1de78 commit fbdc68e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cratedb_toolkit/io/processor/kinesis_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
MESSAGE_FORMAT: str = os.environ.get("MESSAGE_FORMAT", "unknown")
COLUMN_TYPES: str = os.environ.get("COLUMN_TYPES", "")
CRATEDB_SQLALCHEMY_URL: str = os.environ.get("CRATEDB_SQLALCHEMY_URL", "crate://")
CRATEDB_TABLE: str = os.environ.get("CRATEDB_TABLE", "default")
CRATEDB_TABLE: t.Optional[str] = os.environ.get("CRATEDB_TABLE")

logger = logging.getLogger(__name__)
logger.setLevel(LOG_LEVEL)
Expand Down Expand Up @@ -127,7 +127,9 @@ def handler(event, context):
connection.execute(sa.text(operation.statement), parameters=operation.parameters)

# Processing alternating CDC events requires write synchronization.
connection.execute(sa.text(f"REFRESH TABLE {cdc.quote_table_name(CRATEDB_TABLE)}"))
# TODO: Improve interface.
if hasattr(cdc, "table_name"):
connection.execute(sa.text(f"REFRESH TABLE {cdc.table_name}"))

connection.commit()

Expand Down
2 changes: 1 addition & 1 deletion tests/io/dynamodb/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def test_dynamodb_load_table(caplog, cratedb, dynamodb, dynamodb_test_manager):
"""
CLI test: Invoke `ctk load table` for DynamoDB.
"""
cratedb_url = f"{cratedb.get_connection_url()}/testdrive/demo"
dynamodb_url = f"{dynamodb.get_connection_url()}/ProductCatalog?region=us-east-1"
cratedb_url = f"{cratedb.get_connection_url()}/testdrive/demo"

# Populate source database with sample dataset.
dynamodb_test_manager.load_product_catalog()
Expand Down

0 comments on commit fbdc68e

Please sign in to comment.