Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SqlAlchmy @event.lesson_for()? #714

Open
rain-leiyu opened this issue Aug 5, 2020 · 1 comment
Open

How to use SqlAlchmy @event.lesson_for()? #714

rain-leiyu opened this issue Aug 5, 2020 · 1 comment

Comments

@rain-leiyu
Copy link

  • GINO version:1.01
  • Python version:3.7
  • asyncpg version:0.20.1
  • aiocontextvars version:
  • PostgreSQL version:

Description

I wanted to trigger the sqlALchamy listener event, event.lesson_for, before the execution of gino Query, but it does not seem to be executed.

What I Did

@event.listens_for(Query, "before_compile", retval=True)
def before_compile_query(query):
    """A query compilation rule that will add limiting criteria for every
    subclass of HasPrivate"""

    print("query===========================")
@fantix
Copy link
Member

fantix commented Sep 6, 2020

This will be supported in GINO 1.4/2.0 with SQLAlchemy 1.4/2.0. As this is intended to be solved by future versions, we currently don't have a plan to add this in GINO < 1.4. But please feel free to open PRs to add it if you'll be working with SQLAlchemy 1.3 for some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants