Fixes to translation services
This commit is contained in:
parent
36e156e80a
commit
e7b0e712b7
2 changed files with 4 additions and 12 deletions
|
|
@ -83,9 +83,6 @@ app.include_router(
|
||||||
)
|
)
|
||||||
|
|
||||||
app.include_router(permission_router, prefix="/manage", tags=["management"])
|
app.include_router(permission_router, prefix="/manage", tags=["management"])
|
||||||
@app.get("/authenticated-route")
|
|
||||||
async def authenticated_route(user: User = Depends(current_active_user)):
|
|
||||||
return {"message": f"Hello {user.email}!"}
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,20 @@ class SQLAlchemyAdapter():
|
||||||
# self.engine = create_engine(f"{db_type}:///{self.db_location}")
|
# self.engine = create_engine(f"{db_type}:///{self.db_location}")
|
||||||
if db_type == "duckdb":
|
if db_type == "duckdb":
|
||||||
self.engine = create_engine(f"duckdb:///{self.db_location}")
|
self.engine = create_engine(f"duckdb:///{self.db_location}")
|
||||||
self.Session = sessionmaker(bind=self.engine)
|
self.sessionmaker = sessionmaker(bind=self.engine)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Name: ", db_name)
|
|
||||||
print("User: ", db_user)
|
|
||||||
print("Password: ", db_password)
|
|
||||||
print("Host: ", db_host)
|
|
||||||
print("Port: ", db_port)
|
|
||||||
self.engine = create_async_engine(f"postgresql+asyncpg://{db_user}:{db_password}@{db_host}:{db_port}/{db_name}")
|
self.engine = create_async_engine(f"postgresql+asyncpg://{db_user}:{db_password}@{db_host}:{db_port}/{db_name}")
|
||||||
self.Session = sessionmaker(bind=self.engine, class_=AsyncSession, expire_on_commit=False)
|
self.sessionmaker = sessionmaker(bind=self.engine, class_=AsyncSession, expire_on_commit=False)
|
||||||
|
|
||||||
|
|
||||||
async def get_async_session(self):
|
async def get_async_session(self):
|
||||||
async_session_maker = self.Session
|
async_session_maker = self.sessionmaker
|
||||||
async with async_session_maker() as session:
|
async with async_session_maker() as session:
|
||||||
yield session
|
yield session
|
||||||
|
|
||||||
def get_session(self):
|
def get_session(self):
|
||||||
session_maker = self.Session
|
session_maker = self.sessionmaker
|
||||||
with session_maker() as session:
|
with session_maker() as session:
|
||||||
yield session
|
yield session
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue