Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

serial2sql

Read data from serial port a write into database, also can save an sql script to run later or csv files.

Installation

Need to install dependencies, use the package manager pip to install dependencies

pip install mysql-connector-python
pip install pySerial

Configure

Edit the config.json according to your installation a needs:

{
    "port":"COM3",
    "baudrate": 115200,
    "credentials" : {
    "host":"localhost",
    "database":"data",
    "user":"root",
    "password":"",
    "raise_on_warnings": "True"
    },
    "tableName": "datos1",
    "fields": [
        { "name":"indice","type":"INT(10)" },
        { "name":"valor","type":"INT(10)" }
    ]
}

Use

Once you edit config.json just, on terminal run:

python serial2sql.py

Also you can save an sql file to run later with -o parameter:

python serial2sql.py -o output.sql

Or just save to csv file:

python serial2sql.py -o output.csv

Want to know more?

I wrote an article in my blog http://www.gsampallo.com/blog/2019/07/17/serial-a-sql/

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

Read data from serial port a write into database, also can save an sql script to run later or csv files.

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages