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

[destination-snowflake] SnowflakeSQLException: SQL compilation error #39118

Closed
1 task done
talnidam opened this issue Jun 5, 2024 · 3 comments
Closed
1 task done

[destination-snowflake] SnowflakeSQLException: SQL compilation error #39118

talnidam opened this issue Jun 5, 2024 · 3 comments
Labels
area/connectors Connector related issues community connectors/destination/snowflake team/destinations Destinations team's backlog type/bug Something isn't working

Comments

@talnidam
Copy link

talnidam commented Jun 5, 2024

Connector Name

destination-snowflake

Connector Version

3.9.0

What step the error happened?

During the sync

Relevant information

This is a query that Airbyte executed in my Snowflake env in the latest snowflake version:
PUT file:///tmp/2f680376-2d30-445f-bcbe-xxxx.csv.gz @"airbyte_internal"."clientx_raw__stream_postgres_table"xxx-FCB5-4B1F-B425-7EED5EE5F2D4/ PARALLEL = 128;
Error:
SQL compilation error: invalid value [128] for parameter 'PARALLEL'

Relevant log output

Stack Trace: java.lang.RuntimeException: Exceptions thrown while uploading records into stage: net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error:
invalid value [128] for parameter 'PARALLEL'
net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error:
invalid value [128] for parameter 'PARALLEL'
net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error:
invalid value [128] for parameter 'PARALLEL'
        at io.airbyte.integrations.destination.snowflake.operation.SnowflakeStagingClient.uploadRecordsToStage(SnowflakeStagingClient.kt:46)
        at io.airbyte.integrations.destination.snowflake.operation.SnowflakeStorageOperation.writeToStage(SnowflakeStorageOperation.kt:66)
        at io.airbyte.integrations.destination.snowflake.operation.SnowflakeStorageOperation.writeToStage(SnowflakeStorageOperation.kt:27)
        at io.airbyte.cdk.integrations.destination.staging.operation.StagingStreamOperations.writeRecords(StagingStreamOperations.kt:52)
        at io.airbyte.integrations.destination.snowflake.SnowflakeDestination.check(SnowflakeDestination.kt:153)
        at io.airbyte.cdk.integrations.base.IntegrationRunner.runInternal(IntegrationRunner.kt:160)
        at io.airbyte.cdk.integrations.base.IntegrationRunner.run(IntegrationRunner.kt:116)
        at io.airbyte.cdk.integrations.base.adaptive.AdaptiveDestinationRunner$Runner.run(AdaptiveDestinationRunner.kt:68)
        at io.airbyte.integrations.destination.snowflake.SnowflakeDestinationKt.main(SnowflakeDestination.kt:348)

Contribute

  • Yes, I want to contribute

Tasks

No tasks being tracked yet.
@talnidam
Copy link
Author

talnidam commented Jun 5, 2024

Path: airbyte-integrations/connectors/destination-snowflake/src/main/kotlin/io/airbyte/integrations/destination/snowflake/operation/SnowflakeStagingClient.kt

Possible solution:

Line: 81

internal fun getPutQuery(stageName: String, stagingPath: String, filePath: String): String {
    val availableProcessors = Runtime.getRuntime().availableProcessors()
    val parallelValue = minOf(availableProcessors, 99)
    return String.format(
        PUT_FILE_QUERY,
        filePath,
        stageName,
        stagingPath,
        parallelValue
    )
}

@marcosmarxm marcosmarxm changed the title BUG in Snowflake destination with the "PUT queries" [destination-snowflake] SnowflakeSQLException: SQL compilation error Jun 5, 2024
@marcosmarxm
Copy link
Member

I raised the issue to the connector team investigate @talnidam thanks for sharing.

@gisripa
Copy link
Contributor

gisripa commented Jun 5, 2024

Fixed in #39135

@gisripa gisripa closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues community connectors/destination/snowflake team/destinations Destinations team's backlog type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants