Updating an SQL database

Hey Guys. I am working on making a webpage on ignition which runs of based off the SQL database. The database will have all numbers of machines and where they are stored in the storage system. When the user searches the machines name and number on the webpage, it should show them where it is stored by pulling the data from the database. My problem with this is that I need to update the database as it is very outdated. The only way i can do it is through a script in ignition with the updated csv file containing the data on my computer. Can anyone guide me as to how to go about this? I have the webpage roughly designed and I have a script that runs when you type the machine name and number and search it up. I'm unsure as to where to bind the script and what exactly the parameters of the script should be

Hi,

You want to update all values in your database right ?

If yes, what database are you using ?

You can use a software to connect to your database and then edit datas like a table, and maybe import from a CSV.

If you are using MySql/MariaDB, you can install PhpMyAdmin (free and opensource) and access to your database, If my memories are goods you can import a CSV.

For others databases, I know them but you can certainly import from a CSV.

Also you can make a script which will delete all rows from your table and then read your CSV file and insert all row in your table.

Hope this will helps you :slight_smile:

Best regards,
Steven cheron

1 Like

Hi, Steven.
Have a browse through FAQ - Inductive Automation Forum. In the Keep Tidy section it says,

  • Don’t sign your posts β€” every post has your profile information attached to it.

Otherwise, keep up your contributions!

1 Like

Thats what i want to do. I want to use a script and I have the script that will work. Im unsure where to bind it/ test it out. I try running in the script console but it gives an error there that
'Error reading the file:', AttributeError("'com.inductiveautomation.ignition.designer.gui.tool' object has no attribute 'getConnection'",))

Show your script. See Wiki - how to post code on this forum.

View CSV package in python

You can easily read a row inside your CSV using this package.