Database Error in model pg_stat_statements

  • Is this your first time deploying Airbyte?: Yes
  • OS Version / Instance: AWS EC2 (t2.medium)
  • Memory / Disk: you can use something like 4Gb / 16 GB
  • Deployment: Are you using Docker or Kubernetes deployment? Docker
  • Airbyte Version: What version are you using now? 0.40.27
  • Source name/version: Postgres
  • Destination name/version: Redshift
  • Step: Issue at destination while data loading or normalization
  • Description: I am migrating data from Postgres to Redshift and I got one error which says normalization failed.

  syntax error at or near "queryid"
  LINE 22: ..."queryid" != '' then _airbyte_data."queryid" end as queryid,
                                                                  ^
  compiled SQL at ../build/run/airbyte_utils/models/generated/airbyte_tables/vested_airbyte/pg_stat_statements.sql,retryable=<null>,timestamp=1674014777592], io.airbyte.config.FailureReason@255af89b[failureOrigin=normalization,failureType=system_error,internalMessage=syntax error at or near "queryid"
LINE 22: ..."queryid" != '' then _airbyte_data."queryid" end as queryid,,externalMessage=Normalization failed during the dbt run. This may indicate a problem with the data itself.,metadata=io.airbyte.config.Metadata@1ce73f03[additionalProperties={attemptNumber=0, jobId=7, from_trace_message=true}],stacktrace=AirbyteDbtError: 
67 of 150 ERROR creating table model vested_airbyte.pg_stat_statements.................................................. [ERROR in 0.35s]
Database Error in model pg_stat_statements (models/generated/airbyte_tables/vested_airbyte/pg_stat_statements.sql)
  syntax error at or near "queryid"
  LINE 22: ..."queryid" != '' then _airbyte_data."queryid" end as queryid,
                                                                  ^
  compiled SQL at ../build/run/airbyte_utils/models/generated/airbyte_tables/vested_airbyte/pg_stat_statements.sql
Database Error in model pg_stat_statements (models/generated/airbyte_tables/vested_airbyte/pg_stat_statements.sql)
  syntax error at or near "queryid"
  LINE 22: ..."queryid" != '' then _airbyte_data."queryid" end as queryid,
                                                                  ^

Hello there! You are receiving this message because none of your fellow community members has stepped in to respond to your topic post. (If you are a community member and you are reading this response, feel free to jump in if you have the answer!) As a result, the Community Assistance Team has been made aware of this topic and will be investigating and responding as quickly as possible.
Some important considerations that will help your to get your issue solved faster:

  • It is best to use our topic creation template; if you haven’t yet, we recommend posting a followup with the requested information. With that information the team will be able to more quickly search for similar issues with connectors and the platform and troubleshoot more quickly your specific question or problem.
  • Make sure to upload the complete log file; a common investigation roadblock is that sometimes the error for the issue happens well before the problem is surfaced to the user, and so having the tail of the log is less useful than having the whole log to scan through.
  • Be as descriptive and specific as possible; when investigating it is extremely valuable to know what steps were taken to encounter the issue, what version of connector / platform / Java / Python / docker / k8s was used, etc. The more context supplied, the quicker the investigation can start on your topic and the faster we can drive towards an answer.
  • We in the Community Assistance Team are glad you’ve made yourself part of our community, and we’ll do our best to answer your questions and resolve the problems as quickly as possible. Expect to hear from a specific team member as soon as possible.

Thank you for your time and attention.
Best,
The Community Assistance Team

Hello Sharath the best way to debug this is to retrieve the file created by dbt to check what is causing the problem.
You can do it following the steps:

  • docker exec -ti airbyte-server bash
  • cd /tmp/workspace
  • cd <JOB_ID>/0/
  • cat …/build/run/airbyte_utils/models/generated/airbyte_tables/vested_airbyte/pg_stat_statements.sql

Probably you must figure out the job id because I don’t see in your logs. You can share the complete log file and I can get to you

Hi marcosmarxm, Thanks a lot for responding.

02e50343_c2ec_41ad_bdd7_5f60ddcf36fa_logs_1_txt-1.txt (4.2 MB)
02e50343_c2ec_41ad_bdd7_5f60ddcf36fa_logs_1_txt-2.txt (4.2 MB)
02e50343_c2ec_41ad_bdd7_5f60ddcf36fa_logs_1_txt-3.txt (4.2 MB)
02e50343_c2ec_41ad_bdd7_5f60ddcf36fa_logs_1_txt-4.txt (4.1 MB)
02e50343_c2ec_41ad_bdd7_5f60ddcf36fa_logs_1_txt-5.txt (2.7 MB)

I uploaded the complete log (splitted due to more number of rows).

I have a few questions to be clarified.

  1. Why my sync got failed and what is the workaround to make it success?
  2. I guess the tmp tables will be deleted after the sync is completed successfully, correct?
  3. I also want to delete the raw tables that are being created in destination during the sync, how to do that?
  4. Also this sync took me more than 6 hours. My expectation is it should be 1 hour. Please let me know how to reduce the sync time duration.

Desperately looking for the solution.

  1. it is not clear so far, need further investigation. what is clear is: the error happened during normalization with dbt. look there is a file created by dbt which is not working. can you check if there is any queridfield in your source? also check the file I recommend you to take a look
  2. no, Airbyte don’t delete the tmp tables in a failed sync for now. check issue https://github.com/airbytehq/airbyte/issues/7011
  3. you can create procedures/functions in your destination database to execute the cleaning probably for tmp tables too. There isn’t any tutorials about it because is related to db adminstation domain.
  4. sync speed is a topic Airbyte team will take effort this year to improve, adding parallel sync capabilities and improve other bootlenecks.