Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sqlite repo #71

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fb8da82
Checks for correct signature used by the implementation class.
codecakes Aug 12, 2024
dbf8df1
Implements signatures for functional and decoupled GeolocationQuerySe…
codecakes Aug 12, 2024
bfa02f9
adds make test
codecakes Aug 12, 2024
d5ff73a
Merge branch 'main' into feature-location-impl
codecakes Aug 17, 2024
a55413c
ensure signature type checks for interface implementations
codecakes Aug 21, 2024
e288445
refactoring project structure to match a more decoupled logic away fr…
codecakes Aug 21, 2024
d1c733f
added todos command to check all TODOs in project. updated repository…
codecakes Aug 25, 2024
ad6805e
refactored code to adhere to interface requirements and implement mis…
codecakes Aug 25, 2024
b296d89
Merge branch 'main' into feature-location-impl
codecakes Aug 25, 2024
e99d741
update libraries for adding sqlite orm support
codecakes Aug 30, 2024
59fbde7
Merge branch 'main' into feature-location-impl
codecakes Aug 30, 2024
4f24bd9
added support libraries
codecakes Sep 2, 2024
ef85176
implements configure_database_session(services, settings) and on_start
codecakes Sep 2, 2024
3d3ff7c
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 2, 2024
962a1da
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 3, 2024
916defe
refactored unit tests to have dummy functions move to conftest. fix t…
codecakes Sep 7, 2024
22e14e3
refactors dummy tests, removed to conftest. make test works. added te…
codecakes Sep 9, 2024
00d5884
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 9, 2024
90cb943
fix typo
codecakes Sep 9, 2024
a180a72
updated how tests are run to include make test which sets necessary e…
codecakes Sep 9, 2024
a7d58c9
Merge remote-tracking branch 'ssh' into feature/sqlite-repo
codecakes Sep 9, 2024
5d79824
added changes to support api and integration tests
codecakes Sep 9, 2024
c576c43
added sqlite models to support sqlite database. database.py enhances …
codecakes Sep 9, 2024
fca13b0
removed obsolete trigger functions
codecakes Sep 9, 2024
c8f23f9
major rewrite of test services for integration test for Sqlite Repo D…
codecakes Sep 9, 2024
39bbd27
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 9, 2024
5ddf9ad
refactored into setUpTestDatabase class for DRY
codecakes Sep 11, 2024
3d15a1f
WIP test_fetch_facilities integration test
codecakes Sep 11, 2024
87265fd
Feature/sqlite repo: setup for GeoLocationServiceSqlRepoDBTest (#68)
codecakes Sep 9, 2024
fbb2c0a
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 11, 2024
0dd37fb
added docstrings, TODO explainer and specific exception
codecakes Sep 13, 2024
a6f45ed
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 14, 2024
938b62f
Fix: Removed commented out line in pyproject.toml and setup project i…
JiyaGupta-cs Sep 17, 2024
210d0c6
updated promotion product messaging
codecakes Sep 20, 2024
e19185b
adds docker support for integration testing and running containerized…
codecakes Sep 20, 2024
71f5c43
these changes reflect a working spatialite extension to sqlite. the t…
codecakes Sep 22, 2024
b98428a
WIP: Feature/fix infra spatialite (#79)
codecakes Sep 22, 2024
4354017
Merge branch 'main' into feature/sqlite-repo
codecakes Sep 22, 2024
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
7 changes: 0 additions & 7 deletions xcov19/app/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,7 @@ async def setup_database(engine: AsyncEngine) -> None:
async with engine.begin() as conn:
# Enable extension loading
await conn.execute(text("PRAGMA load_extension = 1"))
# db_logger.info("SQLAlchemy setup to load the SpatiaLite extension.")
# await conn.execute(text("SELECT load_extension('/opt/homebrew/Cellar/libspatialite/5.1.0_1/lib/mod_spatialite.dylib')"))
# await conn.execute(text("SELECT load_extension('mod_spatialite')"))
# see: https://sqlmodel.tiangolo.com/tutorial/relationship-attributes/cascade-delete-relationships/#enable-foreign-key-support-in-sqlite
await conn.execute(text("PRAGMA foreign_keys=ON"))
# test_result = await conn.execute(text("SELECT spatialite_version() as version;"))
# print(f"==== Spatialite Version: {test_result.fetchone()} ====")

await conn.run_sync(SQLModel.metadata.create_all)
await conn.commit()
db_logger.info("===== Database tables setup. =====")
Comment on lines 84 to 90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider implementing explicit error handling for database setup operations.

Wrapping the operations in a try-except block would make error handling more robust and aid in debugging if issues occur during database setup.

Suggested change
async with engine.begin() as conn:
# Enable extension loading
await conn.execute(text("PRAGMA load_extension = 1"))
# db_logger.info("SQLAlchemy setup to load the SpatiaLite extension.")
# await conn.execute(text("SELECT load_extension('/opt/homebrew/Cellar/libspatialite/5.1.0_1/lib/mod_spatialite.dylib')"))
# await conn.execute(text("SELECT load_extension('mod_spatialite')"))
# see: https://sqlmodel.tiangolo.com/tutorial/relationship-attributes/cascade-delete-relationships/#enable-foreign-key-support-in-sqlite
await conn.execute(text("PRAGMA foreign_keys=ON"))
# test_result = await conn.execute(text("SELECT spatialite_version() as version;"))
# print(f"==== Spatialite Version: {test_result.fetchone()} ====")
await conn.run_sync(SQLModel.metadata.create_all)
await conn.commit()
db_logger.info("===== Database tables setup. =====")
async with engine.begin() as conn:
try:
await conn.execute(text("PRAGMA load_extension = 1"))
await conn.execute(text("PRAGMA foreign_keys=ON"))
await conn.run_sync(SQLModel.metadata.create_all)
await conn.commit()
db_logger.info("===== Database tables setup. =====")
except SQLAlchemyError as e:
db_logger.error(f"Database setup failed: {str(e)}")
raise

Expand Down
Loading