Skip to content
Merged
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
2 changes: 1 addition & 1 deletion web/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Authlib==1.3.1
requests==2.32.4 # Required by Authlib. Not installed automatically for some reason.
lxml==5.3.0
sqlalchemy==1.3.23
sqlalchemy==1.4.54
alembic==1.5.5
portalocker==3.1.1
psutil==5.8.0
Expand Down
4 changes: 2 additions & 2 deletions web/requirements_py/db_pg8000/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lxml==5.3.0
sqlalchemy==1.3.23
sqlalchemy==1.4.54
alembic==1.5.5
pg8000==1.15.2
pg8000==1.31.4
psutil==5.8.0
portalocker==3.1.1

Expand Down
2 changes: 1 addition & 1 deletion web/requirements_py/db_psycopg2/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lxml==5.3.0
sqlalchemy==1.3.23
sqlalchemy==1.4.54
alembic==1.5.5
psycopg2-binary==2.9.10
psutil==5.8.0
Expand Down
2 changes: 1 addition & 1 deletion 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.15.2
pg8000==1.31.4
pylint==3.2.4
pytest==7.3.1
mkdocs==1.5.3
Expand Down
15 changes: 9 additions & 6 deletions web/server/codechecker_server/api/report_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from sqlalchemy.sql.expression import or_, and_, not_, func, \
asc, desc, union_all, select, bindparam, literal_column, case, cast
from sqlalchemy.orm import contains_eager
from sqlalchemy.types import ARRAY, String

import codechecker_api_shared
from codechecker_api.codeCheckerDBAccess_v6 import constants, ttypes
Expand Down Expand Up @@ -1162,8 +1163,7 @@ def get_analysis_statistics_query(session, run_ids, run_history_ids=None):
.outerjoin(
RunHistory,
RunHistory.id == AnalyzerStatistic.run_history_id) \
.group_by(RunHistory.run_id) \
.subquery()
.group_by(RunHistory.run_id)

query = query.filter(
AnalyzerStatistic.run_history_id.in_(history_ids_subq))
Expand Down Expand Up @@ -1833,8 +1833,9 @@ def getDiffResultsHash(self, run_ids, report_hashes, diff_type,
base_hashes, run_ids, tag_ids)

if self._product.driver_name == 'postgresql':
new_hashes = select([func.unnest(report_hashes)
.label('bug_id')]) \
new_hashes = select([
func.unnest(cast(report_hashes, ARRAY(String)))
.label('bug_id')]) \
.except_(base_hashes).alias('new_bugs')
return [res[0] for res in session.query(new_hashes)]
else:
Expand All @@ -1850,8 +1851,10 @@ def getDiffResultsHash(self, run_ids, report_hashes, diff_type,
select([bindparam('bug_id' + str(i), h)
.label('bug_id')])
for i, h in enumerate(chunk)])
q = select([new_hashes_query]).except_(base_hashes)
new_hashes.extend([res[0] for res in session.query(q)])
q = select([new_hashes_query.subquery()]) \
.except_(base_hashes)
new_hashes.extend([
res[0] for res in session.query(q.subquery())])

return new_hashes
elif diff_type == DiffType.RESOLVED:
Expand Down
15 changes: 5 additions & 10 deletions web/server/codechecker_server/database/db_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ def remove_unused_files(product):
product.endpoint)
try:
bpe_files = session.query(BugPathEvent.file_id) \
.group_by(BugPathEvent.file_id) \
.subquery()
.group_by(BugPathEvent.file_id)
brp_files = session.query(BugReportPoint.file_id) \
.group_by(BugReportPoint.file_id) \
.subquery()
.group_by(BugReportPoint.file_id)

files_to_delete = session.query(File.id) \
.filter(File.id.notin_(bpe_files), File.id.notin_(brp_files))
Expand All @@ -111,8 +109,7 @@ def remove_unused_files(product):
LOG.debug("%d dangling files deleted.", total_count)

files = session.query(File.content_hash) \
.group_by(File.content_hash) \
.subquery()
.group_by(File.content_hash)

session.query(FileContent) \
.filter(FileContent.content_hash.notin_(files)) \
Expand All @@ -137,8 +134,7 @@ def remove_unused_comments(product):
.join(Report,
Comment.bug_hash == Report.bug_id,
isouter=True) \
.filter(Report.id.is_(None)) \
.subquery()
.filter(Report.id.is_(None))
count = session.query(Comment) \
.filter(Comment.id.in_(sub)) \
.delete(synchronize_session=False)
Expand Down Expand Up @@ -192,8 +188,7 @@ def remove_unused_analysis_info(product):
isouter=True) \
.filter(
RunHistoryAnalysisInfo.c.analysis_info_id.is_(None),
ReportAnalysisInfo.c.analysis_info_id.is_(None)) \
.subquery()
ReportAnalysisInfo.c.analysis_info_id.is_(None))

count = session.query(AnalysisInfo) \
.filter(AnalysisInfo.id.in_(to_delete)) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def upgrade():
op.add_column('run_histories',
sa.Column('check_command', sa.Binary(), nullable=True))
sa.Column('check_command', sa.LargeBinary(), nullable=True))


def downgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def upgrade():
op.create_table(
'source_components',
sa.Column('name', sa.String(), nullable=False),
sa.Column('value', sa.Binary(), nullable=False),
sa.Column('value', sa.LargeBinary(), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('username', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('name', name=op.f('pk_source_components'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def upgrade():
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('run_history_id', sa.Integer(), nullable=True),
sa.Column('analyzer_type', sa.String(), nullable=True),
sa.Column('version', sa.Binary(), nullable=True),
sa.Column('version', sa.LargeBinary(), nullable=True),
sa.Column('successful', sa.Integer(), nullable=True),
sa.Column('failed', sa.Integer(), nullable=True),
sa.Column('failed_files', sa.Binary(), nullable=True),
sa.Column('failed_files', sa.LargeBinary(), nullable=True),
sa.ForeignKeyConstraint(
['run_history_id'], ['run_histories.id'],
name=op.f('fk_analyzer_statistics_run_history_id_'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def decode_file_content(content):
'review_status_is_in_source',
sa.Boolean(), server_default='0', nullable=True)
col_rs_message = sa.Column(
'review_status_message', sa.Binary(), nullable=True)
'review_status_message', sa.LargeBinary(), nullable=True)

conn = op.get_bind()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def upgrade():
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('bug_hash', sa.String(), nullable=False),
sa.Column('author', sa.String(), nullable=False),
sa.Column('message', sa.Binary(), nullable=False),
sa.Column('message', sa.LargeBinary(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_comments'))
)
Expand All @@ -40,7 +40,7 @@ def upgrade():
op.create_table(
'file_contents',
sa.Column('content_hash', sa.String(), nullable=False),
sa.Column('content', sa.Binary(), nullable=True),
sa.Column('content', sa.LargeBinary(), nullable=True),
sa.PrimaryKeyConstraint('content_hash', name=op.f('pk_file_contents'))
)

Expand All @@ -54,7 +54,7 @@ def upgrade():
name='review_status'),
nullable=False),
sa.Column('author', sa.String(), nullable=False),
sa.Column('message', sa.Binary(), nullable=False),
sa.Column('message', sa.LargeBinary(), nullable=False),
sa.Column('date', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('bug_hash', name=op.f('pk_review_statuses'))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def upgrade():
sa.Column('tracking_branch', sa.String(), nullable=True))

op.add_column('file_contents',
sa.Column('blame_info', sa.Binary(), nullable=True))
sa.Column('blame_info', sa.LargeBinary(), nullable=True))


def downgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def upgrade():
analysis_info_tbl = op.create_table(
'analysis_info',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('analyzer_command', sa.Binary(), nullable=True),
sa.Column('analyzer_command', sa.LargeBinary(), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_analysis_info'))
)

Expand Down
Loading