import sqlite3
import os
import psycopg2
from dotenv import load_dotenv

load_dotenv()

DB_NAME2 = os.getenv("DB_NAME3")
DB_USER2 = os.getenv("DB_USER3")
DB_PASS2 = os.getenv("DB_PASS3")
DB_HOST2 = os.getenv("DB_HOST3")

conn = psycopg2.connect(dbname=DB_NAME2, 
                        user=DB_USER2,
                        password=DB_PASS2, 
                        host=DB_HOST2)

cursor = conn.cursor()

sl_conn = sqlite3.connect("rpg_db.sqlite3")
sl_cursor = sl_conn.cursor()
characters = sl_cursor.execute('SELECT * FROM charactercreator_character LIMIT 10').fetchall()
print(characters)

create_character_table_query = '''
CREATE TABLE IF NOT EXISTS rpg_characters (
    character_id SERIAL PRIMARY KEY,
	name VARCHAR(30),
	level INT,
	exp INT,
	hp INT,
	strength INT, 
	intelligence INT,
	dexterity INT,
	wisdom INT
)
'''

cursor.execute(create_character_table_query)
conn.commit()

for character in characters:

    insert_query = f''' INSERT INTO rpg_characters 
        (character_id, name, level, exp, hp, strength, intelligence, dexterity, wisdom) VALUES
        {character}
    '''
    cursor.execute(insert_query)

conn.commit()
cursor.close()
conn.close()

[((73, 86), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (84, 86), False, 'from dotenv import load_dotenv\n'), ((99, 120), 'os.getenv', 'os.getenv', (['"""DB_NAME3"""'], {}), "('DB_NAME3')\n", (108, 120), False, 'import os\n'), ((132, 153), 'os.getenv', 'os.getenv', (['"""DB_USER3"""'], {}), "('DB_USER3')\n", (141, 153), False, 'import os\n'), ((165, 186), 'os.getenv', 'os.getenv', (['"""DB_PASS3"""'], {}), "('DB_PASS3')\n", (174, 186), False, 'import os\n'), ((198, 219), 'os.getenv', 'os.getenv', (['"""DB_HOST3"""'], {}), "('DB_HOST3')\n", (207, 219), False, 'import os\n'), ((228, 315), 'psycopg2.connect', 'psycopg2.connect', ([], {'dbname': 'DB_NAME2', 'user': 'DB_USER2', 'password': 'DB_PASS2', 'host': 'DB_HOST2'}), '(dbname=DB_NAME2, user=DB_USER2, password=DB_PASS2, host=\n    DB_HOST2)\n', (244, 315), False, 'import psycopg2\n'), ((420, 453), 'sqlite3.connect', 'sqlite3.connect', (['"""rpg_db.sqlite3"""'], {}), "('rpg_db.sqlite3')\n", (435, 453), False, 'import sqlite3\n')]