Closed Chaostheorie closed 4 years ago
AFAIK, The bakery is not yet published to PyPI.
It's included in 1.0.1. @Chaostheorie can you upgrade and try again?
@fantix let's include that in change log too :)
The problem consists after upgrading. (Note: The gino.__version__=1.0.1
shows the upgrade as well as pip) same traceback. Is this maybe an error with gino-starlette and the Bakery?
@Pentusha Is the 1.0.1 too?
Oh, I'm sorry, baked query is not backported to 1.0.x, it's new in 1.1.
I'll add a more significant development note to the documentation of the master version.
@Chaostheorie yeah sorry for misleading. I didn't check the commits carefully.
@fantix Are there any significant other changes bound to Gino.bake
? Otherwise could a workaround such as overriding the original Gino Object and just adding the bake method work?
Or is there a good way to use the newer version with pip by referencing the git URL?
I was hoping to release 1.1-beta1 with MySQL support, but I guess we could release 1.1-beta1 without MySQL first, and include it in beta2.
I close the issue since the original problem was caused by me not reading the master branche warning.
@fantix Can you give me an estimated amount of time I need to wait for the 1.1-beta1 on pypi
caused by me not reading the master branche warning
Sorry that was on me - the warning is just added after this issue.
an estimated amount of time I need to wait for the 1.1-beta1 on pypi
It's now available here: https://pypi.org/project/gino/1.1.0b1/
Thanks a lot.
Have some issues with the bind after using baked queries. Seems like the Bakery
when creating the bind on initializing the Gino
object. This happens when using await db.set_bind(URL)
(db=initialized Gino object) without even interacting any further. Using the prebake
kwrag doesn't change this behavoiur
Version: GINO 1.1.0-beta.1
Traceback:
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/starlette/routing.py", line 517, in lifespan
await self.startup()
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/starlette/routing.py", line 494, in startup
await handler()
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/gino_starlette.py", line 177, in startup
await self.set_bind(
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/gino_starlette.py", line 226, in set_bind
return await super().set_bind(bind, loop=loop, **kwargs)
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/gino/api.py", line 427, in set_bind
bind = await create_engine(bind, loop=loop, bakery=self._bakery, **kwargs)
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/gino/strategies.py", line 53, in create
dialect = dialect_cls(**dialect_args)
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/gino/dialects/asyncpg.py", line 513, in __init__
self._init_mixin(bakery)
File "/home/chaostheorie/P/boardgame-backend/venv/lib/python3.8/site-packages/gino/dialects/base.py", line 420, in _init_mixin
raise InitializedError("Cannot reuse a closed bakery!")
gino.exceptions.InitializedError: Cannot reuse a closed bakery!
from app import app, db
from app.models import (Game, PlayerGames, Player, Role, PlayerRoles, State, GameStates)
await db.set_bind(Config.DATABASE_URL, prebake=False)
await db.gino.create_all()
app.logger.info("Database created and connected")
Description
The bake attribute/ the bakery is missing from the
gino.ext.starlette.Gino
object. This raises an error if an query should be baked with `db.bake (db = Gino(app, dsn=Config.DATABASE_URL) and db is connected). Schema declaration and normal queries/ updates/ create are fully functional.What I Did
This block is executed after the init of app and db on startup.
Traceback:
´bash ERROR: Traceback (most recent call last): File "/home/username/P/boardgame-backend/venv/lib/python3.8/site-packages/starlette/routing.py", line 517, in lifespan await self.startup() File "/home/username/P/boardgame-backend/venv/lib/python3.8/site-packages/starlette/routing.py", line 494, in startup await handler() File "/home/username/P/boardgame-backend/app/config.py", line 73, in QueryBake app.baked.role_query = db.bake( AttributeError: 'Gino' object has no attribute 'bake'
´