How to use query parameters with BigQuery?
I've been trying to create BigQuery datasets that use the "Query Parameters" field to limit my queries based on lastrundate or lastvalue of one of columns in the query.
The hover text for the "Query Parameters" field states:
Enter the query parameter value, it is the initial value for query parameter. The last run date is optional by default it is '02/01/1700' if is not provided. For example: !{lastvalue:_id}!=1,!{lastrundate:start_date}!=02/01/1944
It's not cear to me how to use parameters here in conjunction with the "fully qualified Google BigQuery query" required by the previous field. Does anyone have any examples of how this might work? The documentation for teh BigQuery connector only mentions the "Query" field and does not describe the "Query Parameters" field.
Thanks,
Lukas
Comments
-
Thanks for your question! The query parameters would be based on the type of SQL you are using from BigQuery. There is either a Legacy SQL (https://cloud.google.com/bigquery/docs/reference/legacy-sql) or Standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql) which can be used. Based off of which SQL you are using, that will dictate how those parameters are included within the query.
More information on the connector, which includes links to the Google BigQuery SQL documentation can be found here: http://knowledge.domo.com?cid=googlebigquery.
If I have answered your question, please click "Yes" on my comment's option.
2 -
Thanks the reply.
The queries all use standard SQL. Though that does not exlain how to use the query parameters (or what would be different than legacy).
As mentioned in my initial question, the documentation has zero mention of the Query Parameters field and no examples of how to use them.
1 -
I've figured out how to get it work, sort of. I'm able to use last rundate in the query and that works:
WHERE updated_at > !{lastrundate:updated_at}!
In the Query Paramter field I was able ot set the initial value using:
!{lastrundate:updated_at}! = '2010-01-01 00:00:00'
Setting the initial value is optional. The first time it runs it uses the intial value and the next time the job runs it uses the batch last run timestamp in the query.
What I can't seem to get to work is the lastvalue option. Using a query like:
WHERE updated_at > !{lastvalue:updated_at}!
and a query paramter initial value:
!{lastvalue:updated_at}!='2010-01-01 00:00:00'
This way does generate a runnable query. However, the where clause always uses the initial value set in the query parameter.
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive