using proxy() with peewee MySQL RDS

107 views
Skip to first unread message

J L

unread,
Sep 6, 2019, 8:08:31 PM9/6/19
to peewee-orm
Any one have success done the proxy() in peewee, and then swap to real call to database, in my case is mysql rds aws.
For example, I do not want to Model make connection to rds right away when the app is loading, only invoke DB when make a REST API call.
I am trying to use proxy() as suggested, but not working.
Thnsk

Charles Leifer

unread,
Sep 7, 2019, 9:01:54 AM9/7/19
to peewe...@googlegroups.com
I'm not clear on why you need proxy. Proxy is for making it easier to declare and configure databases separately from where they are used.

Need a lot more information about your issue to be able to offer any help.

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/e1c3e8f8-bbb1-4108-bebf-ec44a7fb1836%40googlegroups.com.

Jamie L

unread,
Sep 7, 2019, 10:41:39 AM9/7/19
to peewe...@googlegroups.com
thank you for your reply
1. We are using chalice sam to deploy lambda which has the hook to crud service with mysql rds utilize peewee as ORM
2. When the application is loading , it is connected to mysql  right away, the goal is we trying to avoid the BaseModel making connection to DB right away until user make a REST request hit the Crud service (written in python) then it start to make connection / query to DB
3. Something to do between Proxy() and bind_ctx(Model).
Hope this clarify and seeking for your help
Thanks


Charles Leifer

unread,
Sep 7, 2019, 11:23:52 AM9/7/19
to peewe...@googlegroups.com
The connection is only opened when the database is used to execute a query.

Check out setting autoconnect=False when instantiating your database.

This will show you where you are opening any connections implicitly.

Then use good connection management in your app.

Reply all
Reply to author
Forward
0 new messages