Answer the question
In order to leave comments, you need to log in
How to pass dictionary to sqlite database?
Good evening everyone.
Have a dictionary:
inv = {"item1":0,
"item6":0,
"item8":4}
await db.execute("""CREATE TABLE IF NOT EXISTS us (
us TEXT,
id INT,
invent INT,
check INT
)""")
await db.execute("INSERT INTO us VALUES (?, ?, ?, 0)", (member.name, member.id, inv))
Answer the question
In order to leave comments, you need to log in
Dictionary in SQL database, as far as I know, you can not shove, but you can shove a line.
import json
# Например так
a = json.dumps({"a": 1})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question