Google BigQuery Data Loader
Use a GoogleSQL query to load BigQuery rows into a BotDojo knowledge folder as JSON documents.
Prerequisites
Connect Google BigQuery first by following the Google BigQuery integration guide. The connected Google account must be able to create query jobs in the configured project and read every referenced table.
If you do not know the available table paths, use the integration's dataset, table, and schema discovery tools before configuring the loader query.
Query Contract
The Data Loader accepts Google Standard SQL beginning with SELECT or WITH.
Every result must include a unique column named id. You can alias an existing key:
SELECT
CAST(order_id AS STRING) AS id,
customer_id,
status,
total,
updated_at
FROM `analytics.sales.orders`
WHERE updated_at >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)
BotDojo creates one JSON document per row:
- the
idvalue becomes the external document ID and file name - the complete row becomes the JSON content
- the serialized row is used for content versioning
Rows with an empty id are skipped. Loader validation fails when the query result schema does not include an id column.
Create the Data Loader
- Open Knowledge → Loaders.
- Click Create Loader.
- Select Google BigQuery.
- Choose the connected BigQuery integration.
- Enter a
SELECTorWITHquery that returns a uniqueid. - Choose whether to Keep Previous Records:
- enabled: preserve documents that are absent from the latest result
- disabled: remove documents that are absent from the latest result
- Select the destination folder and update schedule.
- Test the loader configuration.
- Save and run the loader.
Scheduled loaders use the OAuth refresh token, so they continue to run without an interactive Google sign-in.
Query Design and Cost
- Add a time-window predicate for scheduled loads when a full scan is unnecessary.
- Fully qualify tables as
`project.dataset.table`unless the integration has a default dataset. - Keep the configured location consistent with every table referenced by the query.
- Review query bytes in BigQuery before scheduling a frequent load.
- Use a stable business key for
id; changing it creates a new BotDojo document.
Manual Verification
- Create a small BigQuery table with two rows and stable IDs.
- Create and test a loader query that aliases the stable key as
id. - Run the loader and confirm two JSON documents appear in the destination folder.
- Change a non-ID field in one row, rerun the loader, and confirm that document updates in place.
- Remove one source row and verify both Keep Previous Records modes.
- Remove the
idalias and confirm loader validation blocks the configuration.
Troubleshooting
- Query must start with SELECT or WITH: Data Loaders intentionally reject DML and DDL.
- Id is a required field: explicitly select or alias a unique column as
id. - Integration not found: reselect an active Google BigQuery connection.
- Permission denied: verify both project job permissions and dataset/table read permissions.
- Location mismatch: update the integration location to match the queried datasets.