вот так работает
import sqlite3 as sq
db, cur = None, None
async def db_start():
global db, cur
db = sq.connect('vocab.db')
cur = db.cursor()
if db:
print('DB is connected')
cur.execute('CREATE TABLE IF NOT EXISTS users(user_id TEXT PRIMARY KEY, date_and_time TEXT, word_drop TEXT, learned_words_id TEXT)')
db.commit()
# async def load_parameters(user_id):
# user = cur.execute("SELECT 1 FROM vocab WHERE user_id == '{key}'".format(key=user_id)).fetchone()
# if not user:
# cur.execute("INSERT INTO vocab VALUES(?, ?, ?, ?)", (user_id, '', '', ''))
# db.commit()
async def edit_parameters(state, user_id):
async with state.proxy() as data:
# cur.execute("UPDATE vocab SET date_and_time = '{}', word_drop = '{}' WHERE user_id == '{}'".format(data['date'], data['ammount'], user_id))
# db.commit()
cur.execute('INSERT INTO users VALUES (?, ?, ?, ?)', tuple(data.values()))
db.commit