id_proverka_bd = cur.execute("SELECT user_id FROM users where user_log = '%s'" %user_logg)
if id_idd != id_proverka_bd:
cur.execute("INSERT INTO users(user_id,user_log) VALUES (%s,%s)",(id_idd,user_logg))
con.commit()
with db.connect(db) as connection:
cursor = connection.cursor()
cursor.execute('''CREATE TABLE USERS (
user_id TEXT PRIMARY key,
username TEXT,
first_name TEXT,
last_name TEXT);'''
def add_user_info(user):
with db.connect(db) as connection:
cursor = connection.cursor()
try:
cursor.execute('''INSERT INTO USERS (user_id, username, first_name, last_name)
VALUES(?,?,?,?);''', user)
except Error:
pass
if cur.fetchone() is None:
CREATE TABLE users(
user_id integer,
user_log varchar(256),
UNIQUE (user_id, user_log)
);