Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1285

Python • 2 python scripts with SQLite3

$
0
0
Hi All,

Relatively new to Raspberry Pi and Python, but so far forum info has been really helpful in getting me up to speed relatively quick.

However, I have a query about best process for this application.

Firstly, let me explain the process:

A wireless barcode scanner will scan a QR code to obtain data about a required product including Quantity, Length, Width and Thickness.

It will write this data to an SQLite3 database ready for use. (I'm surprised how easy setting up a database is with Python!)

The machine will then take the data from ID1 and send it to a PLC for machine processing.

So, my thoughts were:

1st python script that will continuously run in a loop for when it receives barcode data, verify the structure, split the data and write the usable values to variables and write it to the database. Already successfully got this working.

2nd python script is awaiting a signal (again running a continuous loop) and listening for a trigger from the PLC (will be using Snap7 python library to interface with Siemens S7) - once the trigger is received, it will take SQL ID1 data and write it to the Siemens DB and then erase ID1 from the database.

I wanted to keep these two scripts separate as I don't want the barcode scan to be missed if it's processing passing data to the PLC and vice-versa.

But I am concerned that both scripts will be accessing the same database, potentially at the same time. One would be writing data, the other would be reading and erasing data. Is this an issue?

Thanks for any insight into this.

Statistics: Posted by leem2209 — Wed Jan 22, 2025 4:49 pm



Viewing all articles
Browse latest Browse all 1285

Trending Articles