cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Thingworx-Bigquery connection

jgp
8-Gravel
8-Gravel

Thingworx-Bigquery connection

Hi, Is there any way to send data from Thingworx to Bigquery database?

8 REPLIES 8
Surya_Tiwari
15-Moonstone
(To:jgp)

Hi @jgp   We do support connections via jdbc to third-party databases.  You'll need to follow these instructions:

 

  1. Download the JDBC driver from BigQuery
  2. Copy the driver to <tomcat_home>\lib
  3. Restart Tomcat
  4. In Composer, create a Database thing
  5. In the Configuration tab for the Database thing, enter the details for connecting to your database

 

Thanks,

Surya

Many thanks @Surya_Tiwari , for your fast reply.

But, is it the only way to connect with Bigquery Database?

 

Best regards

Surya_Tiwari
15-Moonstone
(To:jgp)

Hi @jgp  Look at the reference article for this.

Rocko
17-Peridot
(To:jgp)

Bigquery has a REST API as well that you could call from ThingWorx using the ContentLoader.

jgp
8-Gravel
8-Gravel
(To:Rocko)

Many thanks @Rocko for your suggestion. Is it possible to have an example?
Thanks for advance.

Rocko
17-Peridot
(To:jgp)

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

 

jgp
8-Gravel
8-Gravel
(To:Rocko)

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

Rocko
17-Peridot
(To:jgp)

You would use the PostJSON service instead. For BigQuery API you will need to find out at the BigQuery help pages.

Top Tags