I want 3 columns to have 9 different values, like a list in Python.
Is it possible? If not in SQLite, then on another database engine?
I want 3 columns to have 9 different values, like a list in Python.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You must serialize the list (or other Python object) into a string of bytes, aka “BLOB”;-), through your favorite means (
marshalis good for lists of elementary values such as numbers or strings &c,cPickleif you want a very general solution, etc), and deserialize it when you fetch it back. Of course, that basically carries the list (or other Python object) as a passive “payload” — can’t meaningfully use it inWHEREclauses,ORDER BY, etc.Relational databases just don’t deal all that well with non-atomic values and would prefer other, normalized alternatives (store the list’s items in a different table which includes a “listID” column, put the “listID” in your main table, etc). NON-relational databases, while they typically have limitations wrt relational ones (e.g., no joins), may offer more direct support for your requirement.
Some relational DBs do have non-relational extensions. For example, PostGreSQL supports an array data type (not quite as general as Python’s lists — PgSQL’s arrays are intrinsically homogeneous).