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()

[((6, 0, 6, 13), 'dotenv.load_dotenv', 'load_dotenv', ({}, {}), '()', False, 'from dotenv import load_dotenv\n'), ((8, 11, 8, 32), 'os.getenv', 'os.getenv', ({(8, 21, 8, 31): '"""DB_NAME3"""'}, {}), "('DB_NAME3')", False, 'import os\n'), ((9, 11, 9, 32), 'os.getenv', 'os.getenv', ({(9, 21, 9, 31): '"""DB_USER3"""'}, {}), "('DB_USER3')", False, 'import os\n'), ((10, 11, 10, 32), 'os.getenv', 'os.getenv', ({(10, 21, 10, 31): '"""DB_PASS3"""'}, {}), "('DB_PASS3')", False, 'import os\n'), ((11, 11, 11, 32), 'os.getenv', 'os.getenv', ({(11, 21, 11, 31): '"""DB_HOST3"""'}, {}), "('DB_HOST3')", False, 'import os\n'), ((13, 7, 16, 38), 'psycopg2.connect', 'psycopg2.connect', (), '', False, 'import psycopg2\n'), ((20, 10, 20, 43), 'sqlite3.connect', 'sqlite3.connect', ({(20, 26, 20, 42): '"""rpg_db.sqlite3"""'}, {}), "('rpg_db.sqlite3')", False, 'import sqlite3\n')]