Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Backfilling tables with via Dataform

Hi all,

We're just starting the process of transitioning from scheduled queries to Dataform pipelines.

One of the really useful parts of scheduled queries is backfilling via the UI (and being able to use @run_time in the code to do this quickly).

I came across the 'Backfilling a daily table with JavaScript' here, but I'm unable to get this working and wondered how others are overcoming this challenge? https://cloud.google.com/dataform/docs/reference/sample-scripts

Cheers

Solved Solved
0 9 2,025
1 ACCEPTED SOLUTION

Here are a few general troubleshooting steps that you might find helpful:

  1. Check for Syntax Errors: Ensure that the JavaScript code has been copied correctly and that there are no syntax errors. Also, make sure the SQL queries inside the operate functions are correct and compatible with your database.

  2. Verify the Date Format: The getDateArray function expects dates in the "YYYY-MM-DD" format. Make sure the dates you're inputting are in this format.

  3. Check the Table Structure: The operate function is used to create a table and then insert data into it. Ensure that the structure of the table (defined in the create table if not exists backfill_table ('fields') part) is correct and suitable for your data. You will need to replace 'fields' with the actual fields of your table.

  4. Validate the Data Insertion Query: The data insertion operation is performed for each date in the array. Make sure the SQL query in this part (insert into backfill_table select fields where day = '${day}') is correct. You may need to adjust this query to suit your specific use case.

If you're still having trouble, it would be helpful if you could provide more specific details about the problem.

View solution in original post

9 REPLIES 9