-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from UW-Macrostrat/database-v3
Database v3
- Loading branch information
Showing
16 changed files
with
289 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ publish: | |
poetry run mono publish | ||
|
||
test: | ||
poetry run pytest -s | ||
poetry run pytest -s -x --failed-first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,17 @@ authors = ["Daven Quinn <[email protected]>"] | |
description = "A SQLAlchemy-based database toolkit." | ||
name = "macrostrat.database" | ||
packages = [{ include = "macrostrat" }] | ||
version = "2.1.3" | ||
version = "3.0.0-beta1" | ||
|
||
[tool.poetry.dependencies] | ||
GeoAlchemy2 = "^0.9.4" | ||
SQLAlchemy = "^1.4.26" | ||
SQLAlchemy-Utils = "^0.37.0" | ||
GeoAlchemy2 = "^0.14.0" | ||
SQLAlchemy = "^2.0.18" | ||
SQLAlchemy-Utils = "^0.41.1" | ||
click = "^8.1.3" | ||
"macrostrat.utils" = "^1.0.0" | ||
psycopg2-binary = "^2.9.1" | ||
psycopg2-binary = "^2.9.6" | ||
python = "^3.8" | ||
sqlparse = "^0.4.0" | ||
sqlparse = "^0.4.4" | ||
|
||
[tool.poetry.dev-dependencies] | ||
"macrostrat.utils" = { path = "../utils", develop = true } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Run a long-running query to test if we can interrupt it. | ||
""" | ||
|
||
from macrostrat.database import Database | ||
from sys import argv, exit | ||
from sqlalchemy.exc import OperationalError | ||
|
||
|
||
db_conn = argv[1] | ||
print(f"Connecting to {db_conn}") | ||
|
||
db = Database(db_conn) | ||
|
||
try: | ||
db.run_sql("SELECT pg_sleep(10);") | ||
except OperationalError as e: | ||
if "canceling statement due to user request" in str(e): | ||
print("Query canceled due to user request.") | ||
exit(1) |
Oops, something went wrong.