Skip to main content
11-Garnet
Feb 9, 2026 4:05 PM UTC
Solved

Thingworx Service fetch data from Stream and insert into DB Connector DB table in bulk.

I have stream which have data in 11 columns, and rows have data as well as null values. I want to create a service which goal is,

  1. Fetch ~500 records from a ThingWorx Stream
  2. Insert them in a single bulk operation into Postgres using a DB Connector.
    please anyone can help me how to create this service and their logics. 
CharlesJiAnswer
Support
Mar 17, 2026 3:23 AM UTC

I think it is possible to simply INSERT the JSON data converted from the Infotable (e.g., infotable.ToJSON()) that you retrieve from the ThingWorx Stream.
However, you would need to manually extract and restructure only the rows[] portion of the JSON to ensure that the resulting fields align correctly with your target PostgreSQL table schema.

3 replies

22-Sapphire I
Feb 13, 2026 2:00 PM UTC

Not an expert by any measure. I searched a little online and it seems that a command called Copy is available in PG SQL?

So once you have the infotable you can convert that to a suitable record set to then copy into your target table?

 

Translate
Support
Feb 19, 2026 12:44 AM UTC

Hi @NJ_10144761,

It appears that there is a post that answers your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,

Charles

Translate
CharlesJiCommunity ManagerAnswer
Support
Mar 17, 2026 3:23 AM UTC

I think it is possible to simply INSERT the JSON data converted from the Infotable (e.g., infotable.ToJSON()) that you retrieve from the ThingWorx Stream.
However, you would need to manually extract and restructure only the rows[] portion of the JSON to ensure that the resulting fields align correctly with your target PostgreSQL table schema.

Translate