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

SqlTable Fails When Running Pulumi Up after Creation #652

Open
fernandodakko opened this issue Nov 25, 2024 · 2 comments
Open

SqlTable Fails When Running Pulumi Up after Creation #652

fernandodakko opened this issue Nov 25, 2024 · 2 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). blocked The issue cannot be resolved without 3rd party action. kind/bug Some behavior is incorrect or out of spec

Comments

@fernandodakko
Copy link

fernandodakko commented Nov 25, 2024

Describe what happened

Creating a Databricks SqlTable fails when running pulumi up/preview after first time creation.

Sample program

def create_bronze_liquidity_snap(catalog: str, schema: str, wh_id: str):
    table_name = "liquidity_snap"
    full_name = f"{catalog}.{schema}.{table_name}"
    table = databricks.SqlTable(
        resource_name=f"uc_table_{full_name}",
        opts=pulumi.ResourceOptions(protect=True),
        args=databricks.SqlTableArgs(
            catalog_name=catalog,
            schema_name=schema,
            name=table_name,
            table_type="MANAGED",
            data_source_format="DELTA",
            owner="Data Engineering",
            cluster_keys=["exchange", "timestamp"],
            warehouse_id=wh_id,
            properties={
                'delta.enableDeletionVectors': "true"
            },
            columns=[
                databricks.SqlTableColumnArgs(
                    name="exchange",
                    type="STRING",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="raw_address",
                    type="STRING",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="timestamp",
                    type="TIMESTAMP",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="lower_tick",
                    type="INTEGER",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="upper_tick",
                    type="INTEGER",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="amount",
                    type="DECIMAL(18, 8)",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="amount0",
                    type="DECIMAL(18, 8)",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="amount1",
                    type="DECIMAL(18, 8)",
                    nullable=False,
                )
            ]
        )
    )

Log output

sdk-v2/provider2.go:520: sdk.helper_schema: changing the 'type' of an existing column is not supported: [email protected]

Affected Resource(s)

SqlTable

Output of pulumi about

CLI          
Version      3.141.0
Go Version   go1.23.3
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  aws         6.59.1
resource  databricks  1.56.0
language  python      unknown

Host     
OS       darwin
Version  15.1
Arch     arm64

... stack name and urns here that's private info

Dependencies:
NAME               VERSION
pip                24.3.1
pulumi_aws         6.59.1
pulumi_databricks  1.56.0
setuptools         75.5.0
wheel              0.45.0

Additional context

Edit. I found the issue. If I remove the space in DECIMAL(18, 8) it works. It seems to be a parsing problem. LEaving the issue here because DECIMAL(X,Y) should be the same as DECIMAL(X, Y)

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@fernandodakko fernandodakko added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 25, 2024
@fernandodakko
Copy link
Author

I'm also running into the same issue when creating a table with complex types. This one doesn't have spaces. It seems the SqlTable object is buggy when parsing the SQL

databricks.SqlTableColumnArgs(
                    name="asks",
                    type="ARRAY<STRUCT<amount DECIMAL(18,8), price DECIMAL(18,6)>>",
                    nullable=False,
                ),
                databricks.SqlTableColumnArgs(
                    name="bids",
                    type="ARRAY<STRUCT<amount DECIMAL(18,8), price DECIMAL(18,6)>>",
                    nullable=False,
),

@guineveresaenger
Copy link
Contributor

Hi @fernandodakko - thank you for filing this issue, and thank you also for updating with your workaround. We're sorry you're having trouble!

This is almost certainly an upstream terraform provider, or even Databricks API issue, as the error comes straight from Databricks.

In fact there are quite a few upstream issues relating to the table type. In particular you might find the comments on this issue helpful. It does sound like formatting here is fussy.

If none of the upstream issues hit your use case, we'd encourage you to file a bug there. Any upstream fixes will be available in this provider on the next release.

@guineveresaenger guineveresaenger added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels Nov 26, 2024
@mjeffryes mjeffryes added blocked The issue cannot be resolved without 3rd party action. and removed awaiting-feedback Blocked on input from the author labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). blocked The issue cannot be resolved without 3rd party action. kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants