class A is mapped to table X which is associated with metadata M1 associated
with engine Q, you'd like to deal with engine Q:
session.execute("select * from some function", mapper=A)
This is all assuming you're in a multi-engine setup, I assume that's what you
mean by "both schemas". If you have an engine in play that is not associated
with any mapped classes at all, you can use
session._connection_for_bind(my_engine) to acquire a connection for now until
the new feature is implemented, or just execute your function using the engine
directly if you don't need the transactional integration of Session.
If you have just one engine in play, none of this is necessary, just bind the
Session to the engine generated by create_engine() and no additional arguments
are needed for Session.execute().
On Dec 25, 2010, at 4:05 PM, Viktor Nagy wrote:
> On Sat, Dec 25, 2010 at 6:59 PM, Michael Bayer <[email protected]>
> wrote:
>
> On Dec 25, 2010, at 11:02 AM, Viktor Nagy wrote:
>
> > hi,
> >
> > I have function defined in one of my postgresql schemas, and my Session is
> > bound to tables in both schemas. How can I run in this case a simple
> > function call like the following:
> >
> > select public."fnPunctajAngajatPeZI"(23, cast(now() as timestamp));
> >
> > I've tried session.execute, but - as the docs state - a mapper should be
> > specified. What does this mean in my case?
>
> The session would like to know which engine it should be using, if it isn't
> just using session.bind. So you'd pass a mapper or SQL clause that would
> point it to one engine or the other.
>
> We'll be adding "bind" to session.execute() and session.connection() soon so
> that you can just pass the actual engine you'd like to use.
>
> sorry for my stupid question, but how can I get a mapper or an SQL clause
> that points to an engine? I have declaratively defined tables, and as this is
> a function call, no table could be mapped to its results.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> 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.
>
>
>
>
> --
> ToolPart Team Ltd
> 6725 Szeged, Boldogasszony sgt. 65.
> Info: +36 30 430 4971
> Tel.: +36 62 469 321
> Fax: +36 62 426 738
> E-mail: [email protected]
> Web: www.toolpart.hu
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> 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.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.