What will be the easiest way of storing a python listing of amounts (for example [4, 7, 10, 39, 91]) to some database? I'm while using Pyramid framework with SQLAlchemy to speak to some database.

Thanks!

Well conceptually you are able to store a listing as a lot of rows inside a table utilizing a one-to-many relation, or focus regarding how to store a listing inside a particular database after sales. For instance postgres can store an assortment inside a particular cell while using sqlalchemy.dialects.postgres.ARRAY data type which could serialize a python array right into a postgres array column.

Use string(Varchar). From Zen of Python: "Simple is preferable to complex."

You should use json in order to save your arrays in db as stings:

In [1]: import json

In [2]: json.dumps([1, 2, 3])
Out[2]: '[1, 2, 3]'

In [3]: json.loads(json.dumps([1, 2, 3]))
Out[3]: [1, 2, 3]

also think about using cjson for better performances and anyjson for excellent fallbacks.