Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
Authlib<2
requests<3 # Required by Authlib. Not installed automatically for some reason.
lxml<6
sqlalchemy<2
alembic<2
sqlalchemy~=2.0
alembic~=1.5
portalocker<4
psutil<8
multiprocess<0.71
Expand Down
6 changes: 3 additions & 3 deletions web/requirements_py/db_pg8000/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lxml<6
sqlalchemy<2
alembic<2
pg8000<=1.31.4
sqlalchemy~=2.0
alembic~=1.5
pg8000~=1.31
psutil<8
portalocker<4

Expand Down
6 changes: 3 additions & 3 deletions web/requirements_py/db_psycopg2/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lxml<6
sqlalchemy<2
alembic<2
psycopg2-binary<=2.9.10
sqlalchemy~=2.0
alembic~=1.5
psycopg2-binary~=2.9
psutil<8
portalocker<4

Expand Down
4 changes: 2 additions & 2 deletions web/requirements_py/dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pycodestyle<=2.12.0
psycopg2-binary<=2.9.10
pg8000<=1.31.4
psycopg2-binary~=2.9
pg8000~=1.31
pylint<3.3
pytest<=7.3.1
mkdocs<=1.5.3
Expand Down
13 changes: 6 additions & 7 deletions web/server/codechecker_server/api/mass_store_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,7 @@ def __init__(self,
self.user_name = user_name

with DBSession(self._config_db) as session:
product: Optional[Product] = session.query(Product) \
.get(product_id)
product: Optional[Product] = session.get(Product, product_id)
if not product:
raise KeyError(f"No product with ID '{product_id}'")

Expand Down Expand Up @@ -576,8 +575,8 @@ def _implementation(self, tm: TaskManager):
raise

with DBSession(tm.configuration_database_session_factory) as session:
db_product: Optional[Product] = session.query(Product) \
.get(self._product_id)
db_product: Optional[Product] = \
session.get(Product, self._product_id)
if not db_product:
raise KeyError(f"No product with ID '{self._product_id}'")

Expand Down Expand Up @@ -668,7 +667,7 @@ def __init__(self,
str, Tuple[Report, Union[DBReport, int]]] = {}

with DBSession(config_db) as session:
product = session.query(Product).get(self.__product.id)
product = session.get(Product, self.__product.id)
self.__report_limit = product.report_limit

def __store_source_files(
Expand Down Expand Up @@ -793,7 +792,7 @@ def __add_file_content(
hasher.update(source_file_content)
content_hash = hasher.hexdigest()

file_content = session.query(FileContent).get(content_hash)
file_content = session.get(FileContent, content_hash)
if not file_content:
if not source_file_content:
source_file_content = get_file_content(source_file_name)
Expand Down Expand Up @@ -1587,7 +1586,7 @@ def finish_checker_run(
""" Finish the storage of the given run. """
try:
LOG.debug("Finishing checker run")
run = session.query(Run).get(run_id)
run = session.get(Run, run_id)
if not run:
return False

Expand Down
17 changes: 9 additions & 8 deletions web/server/codechecker_server/api/product_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import random

from sqlalchemy import text
from sqlalchemy.sql.expression import and_

from sqlalchemy import create_engine, exc
Expand Down Expand Up @@ -244,7 +245,7 @@ def getCurrentProduct(self):
msg)

with DBSession(self.__session) as session:
prod = session.query(Product).get(self.__product.id)
prod = session.get(Product, self.__product.id)

if not prod:
msg = "The product requested has been disconnected from the " \
Expand All @@ -270,7 +271,7 @@ def getProductConfiguration(self, product_id):
], {'productID': product_id})

with DBSession(self.__session) as session:
product = session.query(Product).get(product_id)
product = session.get(Product, product_id)
if product is None:
msg = f"Product with ID {product_id} does not exist!"
LOG.error(msg)
Expand Down Expand Up @@ -354,7 +355,7 @@ def __create_product_database(self, product):
db_pass = convert.from_b64(product_info.password_b64)
db_name = product_info.database

engine_url = URL(
engine_url = URL.create(
drivername=db_engine,
username=db_user,
password=db_pass,
Expand All @@ -365,9 +366,9 @@ def __create_product_database(self, product):
engine = create_engine(engine_url)
try:
with engine.connect() as conn:
conn.execute("commit")
conn.execute(text("commit"))
LOG.info("Creating database '%s'", db_name)
conn.execute(f"CREATE DATABASE {db_name}")
conn.execute(text(f"CREATE DATABASE {db_name}"))
conn.close()
except exc.ProgrammingError as e:
LOG.error("ProgrammingError occurred: %s", str(e))
Expand Down Expand Up @@ -555,7 +556,7 @@ def editProduct(self, product_id, new_config):
new_configuration.
"""
with DBSession(self.__session) as session:
product = session.query(Product).get(product_id)
product = session.get(Product, product_id)
if product is None:
msg = f"Product with ID {product_id} does not exist!"
LOG.error(msg)
Expand Down Expand Up @@ -735,7 +736,7 @@ def editProduct(self, product_id, new_config):
LOG.info("Product configuration edited and saved successfully.")

if product_needs_reconnect:
product = session.query(Product).get(product_id)
product = session.get(Product, product_id)
LOG.info("Product change requires database reconnection...")

LOG.debug("Disconnecting...")
Expand All @@ -762,7 +763,7 @@ def removeProduct(self, product_id):
self.__require_permission([permissions.SUPERUSER])

with DBSession(self.__session) as session:
product = session.query(Product).get(product_id)
product = session.get(Product, product_id)
if product is None:
msg = f"Product with ID {product_id} does not exist!"
LOG.error(msg)
Expand Down
Loading
Loading