On Jan 28, 2014, at 3:37 PM, a_t_smith <amos.t.sm...@gmail.com> wrote:
> During evaluation of Python 2.7 + SqlAlchemy 0.8.x using OracleDialect, I > found most of the features I need exist out of the box; however I don't see a > way to pass arrays as inputs to function calls. > > Am I overlooking an existing capability? ... my searches have come up empty > for Oracle but looks like Postgres has this already. > > In my situation, there are a number of existing custom types in the db > defined like: > "create or replace TYPE int_list AS TABLE OF INTEGER NOT NULL;" > ... > "create or replace TYPE str_list AS TABLE OF VARCHAR2(256 CHAR) NOT NULL;" > > These db types are typically expected as input parameters to functions. > > If support for this does not exist yet, I would be interested in adding > support. > It's unfortunately way beyond the scope of my task to modify the db to > accommodate SqlAlchemy. > > I found the sqlalchemy user defined type support here: > http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#types-custom > > I also found what looks like underlying support for array types in cx_Oracle > here: > https://code.google.com/p/cx-oracle-demos/source/browse/trunk/todo/oracle-array.py?r=2 > > I don't see a way to plumb these cx_Oracle features into sqlalchemy user > defined types since they depend on cx_Oracle connection and cursor types. > > Maybe there's a completely alternate approach I'm overlooking? I’ve created a feature ticket at http://www.sqlalchemy.org/trac/ticket/2925. the steps are pretty straightforward - being able to get the data in and out of cx_oracle is key. cx_oracle need not provide any kind of special typing here, if just passing in formatted strings as arguments is what works, we can do that. so once a full round trip script with raw cx_oracle works, then we can implement a type similar to postgresql.ARRAY for oracle. I do notice that there’s a lot of variety of type here: http://psoug.org/reference/arrays.html are we looking to support associative array as well ala postgresql HSTORE ? overall we need examples that are not PL/SQL based, everything here has to be about DDL and column data types. SQLAlchemy has no real link to PL/SQL.
signature.asc
Description: Message signed with OpenPGP using GPGMail