Skip to main content
1-Visitor
July 1, 2022
Question

Category of widget in Mashup for database query

  • July 1, 2022
  • 1 reply
  • 723 views

Hi There,

Want to provide the postgreSQL database command in input and show the output , which category widget, should I using Thingworx Mashup?

Thanks in advance

1 reply

17-Peridot
July 1, 2022

@PP_10265536 

 

Just to clarify, you want to enter a SQL query as text into a mashup and execute that query on a Postgresql database?  

If so, I would not recommend letting a user enter raw sql into a mashup to have it executed directly on a DB due to the numerous ways that somebody either maliciously or accidentally could mess up your database.  I always wrap my database services in a JavaScript service and hide the implementation from the users. 

 

With that said, if you really need to accomplish this, you'll need to:

 

1. Set up a DatabaseThing that connects to your database

2. Create a service that takes an input called myQuery (or whatever you want)

3.  The code of the service will just be:

 

<<myQuery>>

 

 

4.  In your mashup, you'll just have a Grid widget that you can show the result in.  

 

Hope that helps,

Nick