-
Notifications
You must be signed in to change notification settings - Fork 0
feat(database): Add persistent data management using sqlite & sqlalchemy #177
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
7888fdf
feat(database): Add persistent data management using sqlite & sqlalchemy
MaxNumerique cfcfdd4
default datetime changed for a non decprecated method
MaxNumerique 2d24b77
Apply prepare changes
MaxNumerique 73ff779
minor renames
MaxNumerique ee372e5
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique 6163517
Apply prepare changes
MaxNumerique a53d000
test
MaxNumerique 2974791
Apply prepare changes
MaxNumerique 652149d
Using Flask-SQLAlchemy instead of SQLAlchemy for the database
MaxNumerique dad100a
Apply prepare changes
MaxNumerique 1905756
clean this ?
MaxNumerique 86560cb
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique 1d4b231
Apply prepare changes
MaxNumerique 62bf4bb
some comments
MaxNumerique bf9dfc0
delete commitlint
MaxNumerique ac4782f
Apply prepare changes
MaxNumerique 6777263
tests added
MaxNumerique 023ab17
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique 2011ac5
Converted SQLALCHEMY_DATABASE_URI to use absolute paths
MaxNumerique a970a9c
Apply prepare changes
MaxNumerique 0e9e361
abs path for sqlalchemy_database_uri
MaxNumerique db5a89a
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique a70ef53
abs path
MaxNumerique a985ba5
id and data infos set by database
MaxNumerique 4772ac4
Apply prepare changes
MaxNumerique 2e9266f
trigger
BotellaA 6599029
again
BotellaA 25adb82
trigger
BotellaA 4088ff4
again
BotellaA b8e6ffc
new test session.commit to see if it is relevant
MaxNumerique 5c90a33
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique cb60e9c
Apply prepare changes
MaxNumerique 3ebe500
add type for sub-class of declarative_base()
MaxNumerique f2e07fc
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique 83ee651
Apply prepare changes
MaxNumerique 3bdf3b8
Type["Datas"]
MaxNumerique 52e41bc
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique 199727a
Apply prepare changes
MaxNumerique f597419
test type subclass
MaxNumerique 8a778ad
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique e1490ca
Apply prepare changes
MaxNumerique 76762fd
mypy Base(DeclarativeBase)
MaxNumerique a85d868
Apply prepare changes
MaxNumerique fd1967a
final mypy
MaxNumerique 39764fc
Merge branch 'feat/database' of https://github.com/Geode-solutions/Op…
MaxNumerique 410580f
Apply prepare changes
MaxNumerique 4217ed4
input_file: str
MaxNumerique 9db80dc
final
MaxNumerique 5f4673c
input_file as str
MaxNumerique e3ac529
Apply prepare changes
MaxNumerique 03ba365
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
MaxNumerique File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,16 @@ | ||
| export default { | ||
| extends: ["@commitlint/config-angular"], | ||
| rules: { | ||
| "scope-empty": [2, "never"], | ||
| "subject-empty": [2, "never"], | ||
| "subject-max-length": [0], | ||
| "body-leading-blank": [0], | ||
| "footer-leading-blank": [0], | ||
| "header-max-length": [0], | ||
| "scope-case": [0], | ||
| "subject-case": [0], | ||
| "subject-full-stop": [0], | ||
| "type-case": [0], | ||
| "type-empty": [0], | ||
| }, | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ fastjsonschema==2.16.2 | |
| Flask[async]==3.0.3 | ||
| Flask-Cors==6.0.1 | ||
| werkzeug==3.0.3 | ||
| sqlalchemy==2.0.43 | ||
This file contains hidden or 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 hidden or 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,11 @@ | ||
| from sqlalchemy import create_engine | ||
| from sqlalchemy.orm import sessionmaker | ||
|
|
||
|
|
||
| def get_engine(db_path: str): | ||
| return create_engine(f"sqlite:///{db_path}", echo=False) | ||
|
|
||
|
|
||
| def get_session(engine): | ||
| Session = sessionmaker(bind=engine) | ||
| return Session() |
This file contains hidden or 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,23 @@ | ||
| import uuid | ||
| from datetime import datetime | ||
| from sqlalchemy import Column, String, DateTime, JSON | ||
| from sqlalchemy.orm import declarative_base | ||
|
|
||
| Base = declarative_base() | ||
BotellaA marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def generate_uuid(): | ||
| return str(uuid.uuid4()) | ||
|
|
||
|
|
||
| class Data(Base): | ||
| __tablename__ = "datas" | ||
|
|
||
| id = Column(String, primary_key=True, default=generate_uuid) | ||
| name = Column(String, nullable=False) | ||
| native_file_name = Column(String, nullable=False) | ||
| viewable_file_name = Column(String, nullable=False) | ||
| geode_object = Column(String, nullable=False) | ||
| binary_light_viewable = Column(String, nullable=True) | ||
| input_files = Column(JSON, nullable=True) | ||
BotellaA marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| created_at = Column(DateTime, default=datetime.now) | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.