M
M
Modern_Man2019-02-18 06:27:13
Python
Modern_Man, 2019-02-18 06:27:13

Is there a data type in Sqlite3 that can hold a list of one or more variables?

For example I have a table

cursor.execute("""CREATE TABLE IF NOT EXISTS company
                       (company_name TEXT, year INTEGER, start_price REAL, dividends FLOAT)""")

#заполняю я данные в таким образом
data = ["Lukoil", 2017, 3500, 110]
cursor.execute('INSERT INTO company VALUES(?, ?, ?, ?)', data)

#выводятся данные в такой форме
[('Lukoil', 2015, 3250.0, 95.0)]

#Но мне нужно чтоб в dividends FLOAT можно было вставить не одно число а к примеру два или больше
[('Lukoil', 2015, 3250.0, [95.0, 25.0])] - к примеру так

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-02-18
@Modern_Man

yeah, there is such a type - a text field
and shove json into it
after the selection, decode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question