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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Query Thingworx entities directly from database

Siddharth_Jhs
14-Alexandrite

Query Thingworx entities directly from database

Hi Community,

I am exploring my MS Sql database as persistence provider and was going through it's table structure. I need to perform simple query to fetch all entities with name as custom name mentioned while creating a thing in Thingworx Platform.  

For example I created a thing with name as "MailRepository_Th" . How can I query this directly from database,

I am using following query which doesn't work an expects a column name only. 

 

Query :  "SELECT [entity_id],[name],[thingTemplate]
                FROM [ThingworxHome].[dbo].[thing_model]
                where name = "MailRepository_Th"

 

Kindly suggest. 

Regards,

Sid

 

1 ACCEPTED SOLUTION

Accepted Solutions

Use single quotes ' ' in the filter condition (WHERE).

View solution in original post

3 REPLIES 3

Use single quotes ' ' in the filter condition (WHERE).

Is there a reason the snippets that are provided for this reason (SpotlightSearch) were not used in this scenario?

 

It is important to note that querying directly the persistence provider SQL table is neither supported or recommended.

The persistence provider table structure is internal to ThingWorx, and its structure is not guaranteed to be fixed (eg: the SQL query you specified could run now, but in the next version could fail)

Depending on the usecase, there are reasons to use the internal table, but I want to make sure that when others will look at this thread won't think to directly access the database for such purpose.

 

 

 

It was only for exploring persistence provider tables to see how it behaves internally and how it stores data. 

Thanks.

Top Tags