Thanks for the feature request post and information. At the moment I'm just hoping to have a udt s.t. client code can do something like: a = [1,2,3,4,5] oat = OracleArrayType(cx_Oracle.INTEGER, a) func.some_func_expecting_intarray(oat) rp = session.execute(func)
However, I don't have enough experience with Python or SqlAlchemy yet to know if I'm headed in a sane direction. Per udt listing below - Will the oraArray parameter passed into func.some_func_expecting_intarray get handled by the udt bind_expression? Is there a cleaner way to get at the cursor in the bind_expression method? ------------- from sqlalchemy import func from sqlalchemy.types import UserDefinedType class OracleArrayType(UserDefinedType): def __init__(self, type, list): self._type = type self._list = list def get_col_spec(self): return "ARRAY" def bind_expression(self, bindvalue): session = Session.object_session(self) conn = session.connection() dbobj = conn.getConnection() curs = dbobj.cursor() a = curs.arrayvar(self._type, self._list) return a def column_expression(self, col): return None ------------------- On Tuesday, January 28, 2014 12:37:34 PM UTC-8, a_t_smith 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? > > Thanks in advance for suggestions. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.