Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi, Is there any way to send data from Thingworx to Bigquery database?
Hi @jgp We do support connections via jdbc to third-party databases. You'll need to follow these instructions:
Thanks,
Surya
Many thanks @Surya_Tiwari , for your fast reply.
But, is it the only way to connect with Bigquery Database?
Best regards
Bigquery has a REST API as well that you could call from ThingWorx using the ContentLoader.
Many thanks @Rocko for your suggestion. Is it possible to have an example?
Thanks for advance.
I'd leave that as your homework
It would go roughly like this:
let params = {
url: "https://bigquery.googleapis.com/bigquery/v2/projects/PROJECT_ID/datasets/DATASET_ID/tables", // Replace with your BigQuery API endpoint
headers: {
Authorization: "Bearer YOUR_ACCESS_TOKEN", // Replace with your access token
Accept: "application/json"
}
};
result = Resources["ContentLoaderFunctions"].GetJSON(params);
You can read about ContentLoader here:
https://community.ptc.com/t5/IoT-Tips/ContentLoaderFunctions-in-ThingWorx/ta-p/820230
https://community.ptc.com/t5/ThingWorx-Developers/Consume-REST-API-services-in-Thingworx/td-p/525630
Thanks @Rocko for your help.
This example is to read from Bigquery, right? What should I do to send data to Bigquery instead of reading it? This would be the main function.
Best regards
You would use the PostJSON service instead. For BigQuery API you will need to find out at the BigQuery help pages.