Python script to copy a row of values from SQLite3 to PostgreSQL. (This assumes you have already properly formatted your Postgres database.) Uses the psycopg2 and sqlite3 libraries.
We use the weewx software package to collect data from a Davis Vantage Pro2 Plus weather station on the roof of our science center once every ten minutes. Weewx saves the data to a SQLite database, but most of our other work is done in Postgres. We opted to move the data, and I wrote first a Perl and then a Python script to do it.
oldDbJump.pl
was the original script, written in Perl
dbjump.py
is the current script, written in Python
Both would need to be adjusted for their respective programming environments.
Copy and run as you prefer to run Python. Specify all required information for both databases. Run manually, or set it to run (as we do) with cron.
Before this version, the CS Department used a similar script written in Perl. I rewrote in Python for convenience and to start learning Python.
- Fork.
- Create branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'add new feature'
- Push to branch:
git push origin my-new-feature
- Submit a pull request.
GNU v2 license. See full LICENSE.