yeah, i know, it was just a shot in the dark. for me it's useful to prefilter some user queries, but not their relationships and others (like an audit system with soft delete). anyway, as you said, this already works now and i'll play around a little more with it :)

thanks for all your help, as always!
richard.


On 01/13/2016 06:59 PM, Mike Bayer wrote:
I can't imagine what such a "feature" would look like nor how it
wouldn't require every call everywhere in SQLA internals  well as all
dialects, 3rd party and otherwise, to always remember to mark itself in
some way, annotating the end-user statement as I illustrated is already
available now.

as


On 01/13/2016 01:46 PM, Richard Gerd Kuesters wrote:
yup! i already was going this way. it would be impossible to
"automagically" do this without the performance sacrifice ... lol. well,
if this looks reasonable in some use cases, can this sort of "feature"
be implemented in future sa releases?

best regards,
richard.

On 01/13/2016 04:41 PM, Mike Bayer wrote:
or, place a marker in your own queries:

query(User).execution_options(my_query=True).all()



On 01/13/2016 01:40 PM, Mike Bayer wrote:
similar, you'd need to use sys.exc_info() and walk through the stack
trace to programmatically determine the origin of a Python statement.
You could do this inside the before_execute() event, for example.




On 01/13/2016 01:31 PM, Richard Gerd Kuesters wrote:
Mike, thanks for your attention and i'm sorry, i was not clear enough in
my question.

i would like to know if there's a way to tell if a query was fired by
sqlalchemy internals or by my coded query (programatically).


thanks a lot!
richard.

On 01/13/2016 04:11 PM, Mike Bayer wrote:
sure, use pdb to step through and use the "where" command to show where
each call originates.

alternatively, if this is for profiling, you can use print_callers() as
in the example at
http://docs.sqlalchemy.org/en/rel_1_0/faq/performance.html#code-profiling which
will show the origins of calls, though you'd need to step through things
to see the full chain.  A tool like RunSnakeRun can provide a graphical
display instead.


On 01/13/2016 11:58 AM, Richard Gerd Kuesters wrote:
hi all!

i'm wondering if there's a way to determinate if a query was "launch" by
my code (ex. session.query(Entity)...) or by the internals of sqlalchemy
(backref, relationship, etc). i think it's better to use a example,
based on *adjacency_list.py*:

http://pastebin.com/q3yx36vn

in the code, you'll notice there's only one query *literally* written
(in the main script), but "STEP" is called more than once (by
internals). my question is: can I differ between them?

thanks a lot!
richard.

--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

<<attachment: richard.vcf>>

Reply via email to