Skip to content

Commit

Permalink
Update dependencies (#73)
Browse files Browse the repository at this point in the history
Bump email-validator from 1.3.1 to 2.0.0.post2

Bumps [email-validator](https://github.com/JoshData/python-email-validator) from 1.3.1 to 2.0.0.post2.
- [Release notes](https://github.com/JoshData/python-email-validator/releases)
- [Changelog](https://github.com/JoshData/python-email-validator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/JoshData/python-email-validator/commits)

---
updated-dependencies:
- dependency-name: email-validator
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Bump flask from 2.2.3 to 2.3.1

Bumps [flask](https://github.com/pallets/flask) from 2.2.3 to 2.3.1.
- [Release notes](https://github.com/pallets/flask/releases)
- [Changelog](https://github.com/pallets/flask/blob/2.3.1/CHANGES.rst)
- [Commits](pallets/flask@2.2.3...2.3.1)

---
updated-dependencies:
- dependency-name: flask
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Bump pip from 23.0.1 to 23.1.2

Bumps [pip](https://github.com/pypa/pip) from 23.0.1 to 23.1.2.
- [Release notes](https://github.com/pypa/pip/releases)
- [Changelog](https://github.com/pypa/pip/blob/main/NEWS.rst)
- [Commits](pypa/pip@23.0.1...23.1.2)

---
updated-dependencies:
- dependency-name: pip
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Bump setuptools from 67.4.0 to 67.7.2

Bumps [setuptools](https://github.com/pypa/setuptools) from 67.4.0 to 67.7.2.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst)
- [Commits](pypa/setuptools@v67.4.0...v67.7.2)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Bump sqlalchemy from 1.4.47 to 2.0.12

Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 1.4.47 to 2.0.12.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
hluk and dependabot[bot] committed May 10, 2023
1 parent d076ba7 commit 98fd019
Show file tree
Hide file tree
Showing 10 changed files with 1,120 additions and 940 deletions.
1,988 changes: 1,076 additions & 912 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include = [

[tool.poetry.dependencies]
python = ">=3.9,<3.10"
flask = "^2.2.3"
flask = "^2.3.1"
gunicorn = "^20.1.0"
fedora-messaging = "^3.2.0"
"stomp.py" = "^8.1.0"
Expand All @@ -34,13 +34,13 @@ tox = {version = "^4.4.8", optional = true}
tox-docker = {version = "^4.0.0", optional = true}

Flask-SQLAlchemy = "^3.0.3"
SQLAlchemy = {version = "^1.4.39"}
SQLAlchemy = {version = "^2.0.12"}
psycopg2-binary = {version = "^2.9.3"}
alembic = "^1.10.2"
iso8601 = "^1.0.2"
Flask-Pydantic = "^0.11.0"

email-validator = "^1.3.1"
email-validator = "^2.0.0"
python-ldap = "^3.4.3"
Flask-pyoidc = "^3.13.0"
Flask-Session = "^0.4.0"
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
wheel==0.40.0
pip==23.0.1
setuptools==67.4.0
pip==23.1.2
setuptools==67.7.2
2 changes: 2 additions & 0 deletions resultsdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def create_app(config_obj=None):
app = Flask(__name__)
app.secret_key = "replace-me-with-something-random"

app.session_cookie_name = "session"

# make sure app behaves when behind a proxy
app.wsgi_app = ReverseProxied(app.wsgi_app)

Expand Down
27 changes: 18 additions & 9 deletions resultsdb/alembic/versions/34760e10040b_add_aborted_outcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
depends_on = None

from alembic import op
from sqlalchemy import text
import sqlalchemy as sa

old_values = ("PASSED", "INFO", "FAILED", "ERROR", "WAIVED", "NEEDS_INSPECTION")
Expand All @@ -28,32 +29,40 @@ def upgrade():
if op.get_bind().engine.url.drivername.startswith("postgresql"):
tmp_enum.create(op.get_bind(), checkfirst=False)
op.execute(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome_tmp "
" USING outcome::text::resultoutcome_tmp"
text(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome_tmp "
" USING outcome::text::resultoutcome_tmp"
)
)
old_enum.drop(op.get_bind(), checkfirst=False)
new_enum.create(op.get_bind(), checkfirst=False)
op.execute(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome "
" USING outcome::text::resultoutcome"
text(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome "
" USING outcome::text::resultoutcome"
)
)
tmp_enum.drop(op.get_bind(), checkfirst=False)


def downgrade():
# this migration is postgresql specific and fails on sqlite
if op.get_bind().engine.url.drivername.startswith("postgresql"):
op.execute("UPDATE result SET outcome='ERROR' WHERE outcome='ABORTED'")
op.execute(text("UPDATE result SET outcome='ERROR' WHERE outcome='ABORTED'"))

tmp_enum.create(op.get_bind(), checkfirst=False)
op.execute(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome_tmp "
" USING outcome::text::resultoutcome_tmp"
text(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome_tmp "
" USING outcome::text::resultoutcome_tmp"
)
)
new_enum.drop(op.get_bind(), checkfirst=False)
old_enum.create(op.get_bind(), checkfirst=False)
op.execute(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome "
" USING outcome::text::resultoutcome"
text(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome "
" USING outcome::text::resultoutcome"
)
)
tmp_enum.drop(op.get_bind(), checkfirst=False)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation, sessionmaker
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy.sql import text
import logging

Expand All @@ -28,7 +28,7 @@ class Job(Base):

id = sa.Column(sa.Integer, primary_key=True)
uuid = sa.Column(sa.String(36), unique=True)
results = relation("Result", backref="job")
results = relationship("Result", backref="job")


class Result(Base):
Expand All @@ -47,7 +47,9 @@ def upgrade():
jobs_to_delete = []

job_count_query = connection.execute(
"select count(*) from job where uuid in (select uuid from job group by uuid having count(uuid) > 1);"
text(
"select count(*) from job where uuid in (select uuid from job group by uuid having count(uuid) > 1);"
)
)
job_count = -1
for row in job_count_query:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
depends_on = None

from alembic import op
from sqlalchemy import text
import sqlalchemy as sa


Expand All @@ -29,6 +30,8 @@ def upgrade():

def downgrade():
op.execute(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome USING outcome::resultoutcome;"
text(
"ALTER TABLE result ALTER COLUMN outcome TYPE resultoutcome USING outcome::resultoutcome;"
)
)
op.drop_index("result_idx_outcome", table_name="result")
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from alembic import op
import sqlalchemy as db
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, relation, sessionmaker
from sqlalchemy.orm import relationship, sessionmaker
import uuid
import logging

Expand All @@ -24,7 +24,6 @@


db.relationship = relationship
db.relation = relation


class GroupsToResults(Base):
Expand Down Expand Up @@ -61,8 +60,8 @@ class Result(Base):
testcase_name = db.Column(db.Text)

groups = db.relationship("Group", secondary="groups_to_results", backref="results")
job = db.relation("Group") # , lazy = False)
testcase = db.relation("Testcase", backref="results") # , lazy = False)
job = db.relationship("Group") # , lazy = False)
testcase = db.relationship("Testcase", backref="results") # , lazy = False)

logger = logging.getLogger("alembic")
connection = op.get_bind()
Expand Down Expand Up @@ -105,8 +104,8 @@ class Result(Base):
testcase_name = db.Column(db.Text, db.ForeignKey("testcase.name"))

groups = db.relationship("Group", secondary="groups_to_results", backref="results")
job = db.relation("Group") # , lazy = False)
testcase = db.relation("Testcase", backref="results") # , lazy = False)
job = db.relationship("Group") # , lazy = False)
testcase = db.relationship("Testcase", backref="results") # , lazy = False)

op.add_column("result", db.Column("job_id", db.INTEGER(), autoincrement=False, nullable=True))
op.add_column(
Expand Down
2 changes: 1 addition & 1 deletion resultsdb/controllers/api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def healthcheck():
Returns a 200 response if the application is alive and able to serve requests.
"""
try:
db.session.execute("SELECT 1 FROM result LIMIT 0").fetchall()
db.session.execute(db.text("SELECT 1 FROM result LIMIT 0")).fetchall()
except Exception:
app.logger.exception("Healthcheck failed on DB query.")
return jsonify({"message": "Unable to communicate with database"}), 503
Expand Down
7 changes: 4 additions & 3 deletions resultsdb/models/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import uuid as lib_uuid

from flask import current_app
from sqlalchemy.orm import relationship

from resultsdb.models import db
from resultsdb.serializers import DBSerialize
Expand Down Expand Up @@ -60,7 +61,7 @@ class Group(db.Model, DBSerialize):
description = db.Column(db.Text)
ref_url = db.Column(db.Text)

results = db.relationship("Result", secondary="groups_to_results", backref="groups")
results = relationship("Result", secondary="groups_to_results", backref="groups")

__table_args__ = (
db.Index(
Expand Down Expand Up @@ -105,8 +106,8 @@ class Result(db.Model, DBSerialize):
note = db.Column(db.Text)
ref_url = db.Column(db.Text)

testcase = db.relation("Testcase", backref="results") # , lazy = False)
data = db.relation("ResultData", backref="result") # , lazy = False)
testcase = relationship("Testcase", backref="results") # , lazy = False)
data = relationship("ResultData", backref="result") # , lazy = False)

__table_args__ = (
db.Index(
Expand Down

0 comments on commit 98fd019

Please sign in to comment.