Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing REFRESH_INTERVAL_SECONDS in GlueCatalogIntegration when value is empty #191

Open
alejandrogobu opened this issue Jan 27, 2025 · 0 comments

Comments

@alejandrogobu
Copy link

When using the following code to define a GlueCatalogIntegration:

glue_catalog_integration = GlueCatalogIntegration( name="some_catalog_integration", table_format="ICEBERG", glue_aws_role_arn="arn:aws:iam::123456789012:role/SnowflakeAccess", glue_catalog_id="some_glue_catalog_id", catalog_namespace="some_namespace", enabled=True, glue_region="us-west-2", comment="Integration for AWS Glue with Snowflake." )

Running a desc command to validate the integration results in the following traceback:

Traceback (most recent call last): File "/Users/Projects/deploy_account/deploy_account_v2.py", line 190, in <module> plan = bp.plan(session) File "/Users/Projects/deploy_account/.venv/lib/python3.13/site-packages/titan/blueprint.py", line 906, in plan remote_state = self.fetch_remote_state(session, manifest) File "/Users/Projects/deploy_account/.venv/lib/python3.13/site-packages/titan/blueprint.py", line 642, in fetch_remote_state data = data_provider.fetch_resource(session, urn) File "/Users/Projects/deploy_account/.venv/lib/python3.13/site-packages/titan/data_provider.py", line 610, in fetch_resource return getattr(__this__, f"fetch_{urn.resource_label}")(session, urn.fqn) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/Users/Projects/deploy_account/.venv/lib/python3.13/site-packages/titan/data_provider.py", line 817, in fetch_catalog_integration properties = _desc_type2_result_to_dict(desc_result, lower_properties=True) File "/Users/Projects/deploy_account/.venv/lib/python3.13/site-packages/titan/data_provider.py", line 103, in _desc_type2_result_to_dict value = int(value)

Root Cause:

The issue appears to be related to the REFRESH_INTERVAL_SECONDS parameter. In older integrations where this parameter was not defined, its value is empty. When attempting to convert this empty value to an integer, the error is raised.

Proposed Solution:

I modified the _desc_type2_result_to_dict function to handle empty values for Integer types. Here’s the updated code:

def _desc_type2_result_to_dict(desc_result, lower_properties=False): result = {} for row in desc_result: property = row["property"] if lower_properties: property = property.lower() value = row["property_value"] if row["property_type"] == "Boolean": value = value == "true" elif row["property_type"] == "Long": value = value or None elif row["property_type"] == "Integer": # Validation to avoid converting empty values value = int(value) if value.isdigit() else None elif row["property_type"] == "String": value = value or None elif row["property_type"] == "List": value = _parse_list_property(value) # Not sure this is correct. External Access Integration uses this elif row["property_type"] == "Object": value = _parse_list_property(value) result[property] = value return result

This change ensures that empty values for Integer properties are correctly handled, avoiding the ValueError.

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant