Skip to content

Commit

Permalink
Use pg8000 consistently (bcgov#3140)
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 authored Nov 8, 2024
1 parent 7172e85 commit ad9da4d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions auth-api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions auth-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cattrs = "^23.2.3"
orjson = "^3.10.7"
sqlalchemy-utils = "^0.41.2"
psycopg2 = "^2.9.9"
pytz = "^2024.2"

# VCS dependencies
sql-versioning = { git = "https://github.com/bcgov/sbc-connect-common.git", subdirectory = "python/sql-versioning", branch = "main" }
Expand Down
4 changes: 2 additions & 2 deletions auth-api/src/auth_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _Config: # pylint: disable=too-few-public-methods
f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432"
)
else:
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"

# JWT_OIDC Settings
JWT_OIDC_WELL_KNOWN_CONFIG = os.getenv("JWT_OIDC_WELL_KNOWN_CONFIG")
Expand Down Expand Up @@ -358,4 +358,4 @@ class MigrationConfig: # pylint: disable=too-few-public-methods
f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432"
)
else:
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
5 changes: 2 additions & 3 deletions auth-api/src/auth_api/models/pubsub_message_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
Currently used by the account-mailer / auth-queue. This prevents duplicates.
"""

import datetime as dt
from datetime import datetime, timezone

import pytz
from sqlalchemy import Column, DateTime, Integer, String

from .db import db
Expand All @@ -19,7 +18,7 @@ class PubSubMessageProcessing(db.Model):

id = Column(Integer, index=True, primary_key=True)
cloud_event_id = Column(String(250), nullable=False)
created = Column(DateTime, default=dt.datetime.now(pytz.utc))
created = Column(DateTime, default=lambda: datetime.now(tz=timezone.utc))
message_type = Column(String(250), nullable=False)
processed = Column(DateTime, nullable=True)

Expand Down

0 comments on commit ad9da4d

Please sign in to comment.