Skip to content

Commit

Permalink
Merge pull request #949 from fractal-analytics-platform/update_sqlmodel
Browse files Browse the repository at this point in the history
Update sqlmodel to 0.0.11
  • Loading branch information
tcompa authored Nov 10, 2023
2 parents 58711e9 + a703966 commit 263a91d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 53 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Improve delete-resource endpoint (\#943).
* Expose JSON Schema for the `ManifestV1` Pydantic model (\#942).
* Dependencies:
* Upgrade sqlmodel to 0.0.11 (\#949).
* Testing:
* Fix bug in local tests with Docker/SLURM (\#948).

Expand Down
1 change: 0 additions & 1 deletion fractal_server/app/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class Config:

start_timestamp: datetime = Field(
default_factory=get_timestamp,
nullable=False,
sa_column=Column(DateTime(timezone=True)),
)
end_timestamp: Optional[datetime] = Field(
Expand Down
1 change: 0 additions & 1 deletion fractal_server/app/models/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ class State(_StateBase, SQLModel, table=True):
data: dict[str, Any] = Field(sa_column=Column(JSON), default={})
timestamp: datetime = Field(
default_factory=get_timestamp,
nullable=False,
sa_column=Column(DateTime(timezone=True)),
)
84 changes: 34 additions & 50 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exclude = [
python = "^3.9"
python-dotenv = "^0.20.0"
fastapi = "^0.103.0"
sqlmodel = "^0.0.8"
sqlmodel = "^0.0.11"
aiosqlite = "^0.17.0"
fastapi-users = {extras = ["oauth"], version = "^12.1.0"}
alembic = "^1.9.1"
Expand Down
9 changes: 9 additions & 0 deletions tests/fixtures_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,22 @@ async def db_create_tables(override_settings):
from fractal_server.app.db import DB
from fractal_server.app.models import SQLModel

# Calling set_db guarantees that a new pair of sync/async engines is
# created every time. This is needed for our Postgresql-based CI, due to
# the presence of Enums. See
# https://github.com/fractal-analytics-platform/fractal-server/pull/934#issuecomment-1782842865
# and
# https://docs.sqlalchemy.org/en/14/dialects/postgresql.html#prepared-statement-cache.
DB.set_db()

engine = DB.engine_sync()
metadata = SQLModel.metadata
metadata.create_all(engine)

yield

metadata.drop_all(engine)
engine.dispose()


@pytest.fixture
Expand Down

0 comments on commit 263a91d

Please sign in to comment.