[sqlalchemy] Storing a two dimensional list structure with different item types in Postgres 9.1

2012-12-20 Thread Andreas Jung
Using Postgres 9.1, SqlAlchemy 0.8.

I need to store information like

[
[10, 'liters', 'tea'],
[20, 'milliliters', 'salt'],
]

as one column into Postgres.

What is the best way to do this? Of course I use a second table with a 1:N 
relationship
I am thinking about using the Postgres Array type for this...is there a 
better option?
Right now there are numeric and string values to be stored. I can of course
convert numeric values to strings if needed.

Any options?

Andreas

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/9jnn5iZY68IJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] Storing a two dimensional list structure with different item types in Postgres 9.1

2012-12-20 Thread Robert Forkel
If you are only after storage (leaving aside querying, indexing, ...)
a simple JSON column [1] could do. The advantage being portability
between databases. I've used this to as simple key-value store of data
associated with a row.
regards
robert

[1] http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#marshal-json-strings

On Thu, Dec 20, 2012 at 11:20 AM, Andreas Jung zopyxfil...@gmail.com wrote:
 Using Postgres 9.1, SqlAlchemy 0.8.

 I need to store information like

 [
 [10, 'liters', 'tea'],
 [20, 'milliliters', 'salt'],
 ]

 as one column into Postgres.

 What is the best way to do this? Of course I use a second table with a 1:N
 relationship
 I am thinking about using the Postgres Array type for this...is there a
 better option?
 Right now there are numeric and string values to be stored. I can of course
 convert numeric values to strings if needed.

 Any options?

 Andreas

 --
 You received this message because you are subscribed to the Google Groups
 sqlalchemy group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/sqlalchemy/-/9jnn5iZY68IJ.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 To unsubscribe from this group, send email to
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.