Good idea, unfortunately that didn't work: >>> model.session Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'module' object has no attribute 'session'
But model.metadata.bind.execute(my_sql) does work. Although "select * from dual" didn't work, I had to specify column names. I've been able to run stuff like: model.metadata.bind.execute("create or replace directory %s as '%s'" % (ora_dir,internal_path)) q = model.metadata.bind.execute(("select table_name, def_tablespace_name from dba_part_tables where owner = '%s' and partitioning_type = 'LIST'") % my_user) and sproc_text = "call OHDWH.TEST_PROC(:the_id)" bind_data = {"the_id":id.encode('latin-1')} model.metadata.bind.execute(sproc_text,bind_data) I'm still running into issues where the database doesn't like getting sent Unicode, but other than that I'm doing what I need to do. Yeah, this completely gives up on ORM, but I'm writing a web app for importing database exports into a warehouse, so at some point I need to manipulate the DB directly. Thanks for the suggestions. On Sep 8, 2:16 pm, dimazest <[EMAIL PROTECTED]> wrote: > hello > > On Sep 8, 5:11 pm, John Lavoie <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > I'm using SQLAlchemy in Pylons. I'm also using Elixir, which was set > > up based on Jonathan's post here:http://cleverdevil.org/computing/68/ > > > I need to call a stored procedure. I don't care about return values > > yet, I just want to run something in the database. > > > So far I've just been struggling to execute any raw SQL at all, let > > alone my PL/SQL procedure. > > > model.Session.execute("select * from dual") > > You should try model.session.execute() (with small s character) > because you deal with a session object, not with a Session class. > > > > > Results in this traceback: > > Traceback (most recent call last): > > File "<console>", line 1, in <module> > > File "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta3-py2.5.egg > > \sqlalchemy\orm\scoping.py", line 106, in do > > return getattr(self.registry(), name)(*args, **kwargs) > > File "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta3-py2.5.egg > > \sqlalchemy\orm\session.py", line 742, in execute > > engine = self.get_bind(mapper, clause=clause, _state=_state) > > File "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta3-py2.5.egg > > \sqlalchemy\orm\session.py", line 907, in get_bind > > ', '.join(context))) > > UnboundExecutionError: Could not locate a bind configured on SQL > > expression or this Session > > > I am using Pylons 0.9.7-rc1, SQLAlchemy 0.5.0beta3, Elixir 0.6.1, and > > cx_oracle 4.3.1 > > > Can anyone suggest what might be configured wrong? > > > Thanks, > > John Lavoie --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---