Trouble sending created_at timestamps from Retool form to BigQuery

  1. My goal:
    I want to automatically populate the created_at timestamp when a form is submitted in Retool, and insert that value into a BigQuery table using the GUI (not raw SQL).

  2. Issue:
    Even though I'm trying to pass a timestamp, the value is being sent to BigQuery as [object Object], which causes an error like Invalid timestamp: '[object Object]'.

  3. Steps I've taken to troubleshoot:

  • Tried using this expression in the value field:
    {{ { RT$BQ_TYPE: "TIMESTAMP", value: new Date() } }}
  • Tried formatting the datetime as an ISO string:
    {{ new Date().toISOString() }}
  • Also tried using a JavaScript query (get_current_time) that returns the current timestamp in ISO format (toISOString()), and referencing it via {{ get_current_time.data }}
  • When I use RT$BQ_TYPE directly in the GUI insert query, the object sometimes gets passed as a string instead of a native timestamp.
  1. Additional info:
  • Retool Cloud
  • Using GUI mode for database inserts (not raw SQL)
  • I'm inserting into BigQuery, and the created_at field is of type TIMESTAMP

Hey @mayaas, Welcome to the Retool Community

Auto-populate a created_at timestamp in Retool and insert it into a BigQuery TIMESTAMP field using the GUI (not raw SQL), use this format to avoid [object Object] errors:

To insert a valid TIMESTAMP in BigQuery using Retool's GUI query editor:

{{ moment().toISOString() }}
  • Uses Moment.js (built into Retool).
  • Formats current time as ISO 8601, which BigQuery accepts.

Alternative :

{{ new Date().toISOString() }}

This also produces an ISO 8601 string that BigQuery accepts for TIMESTAMP fields.

2 Likes