diff options
| -rw-r--r-- | script.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/script.py b/script.py new file mode 100644 index 0000000..fd60a3c --- /dev/null +++ b/script.py @@ -0,0 +1,16 @@ +import sqlite3 +import psycopg2 + +conn = sqlite3.connect("/home/http/famille/famille.db", + detect_types=sqlite3.PARSE_DECLTYPES) +conn.row_factory = sqlite3.Row +conn.execute("PRAGMA foreign_keys=ON") +cur = conn.execute("SELECT id, user_name, password from users") + +authdb = psycopg2.connect("postgres://auth_master@localhost/authdb") +sql_str = "INSERT INTO users(id, name, password) VALUES(%s, %s, %s)" +with authdb.cursor() as c: + for id, name, password in cur: + c.execute(sql_str, (id, name, password)) +authdb.commit() +authdb.close() |
