I am using SQLAlchemy 0.6.3 with PostgreSQL 8.4 when compressing Debian. I want a table in which a single column stores something in PostgreSQL, which is displayed in Python as a list of whole lists or tuples of whole tuples. For example.
((1,2), (3,4), (5,6,7))
In the example below, this column is model . I thought a reasonable approach could be to store the material as a PG 2 size table, which in PG looks like integer[][] . I don't know in what form SQLA will return this in Python, but I hope this is something like a tuple of tuples.
However, I cannot figure out how to say SQLA to give me a two-dimensional Integer array. documentation for sqlalchemy.dialects.postgresql.ARRAY says
item_type - The data type of the elements of this array. Note that dimension does not matter here, so multidimensional arrays like INTEGER [] [] are built as ARRAY (Integer), not as ARRAY (ARRAY (integer)) or such. The type display is displayed on the fly.
Unfortunately, I have no idea what that means. How can display type be displayed on the fly? It must create the correct DDL. My first and only guess on how to do this would be ARRAY(ARRAY(Integer)) . I am currently
crossval_table = Table( name, meta, Column('id', Integer, primary_key=True), Column('created', TIMESTAMP(), default=now()), Column('sample', postgresql.ARRAY(Integer)), Column('model', postgresql.ARRAY(Integer)), Column('time', Float), schema = schema,
This creates the next DDL
CREATE TABLE crossval ( id integer NOT NULL, created timestamp without time zone, sample integer[], model integer[], "time" double precision );
which is wrong, of course. What am I missing?