-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make db requirements optional (#110)
* Make db requirements optional * Add alembic to package * Update font and plotting module * Fix mpl font file + DB defaults
- Loading branch information
1 parent
a318a2e
commit 69d43ba
Showing
18 changed files
with
189 additions
and
247 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import metrics, plot | ||
from .check import ColumnCheck | ||
|
||
__all__ = ['ColumnCheck'] | ||
__all__ = ['ColumnCheck', 'plot', 'metrics'] |
File renamed without changes.
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,4 @@ | ||
[alembic] | ||
script_location = insight:alembic | ||
version_path_separator = os # Use os.pathsep. Default configuration used for new projects. | ||
sqlalchemy.url = postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DATABASE} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Python script that will apply the migrations up to head | ||
import os | ||
|
||
import alembic.config | ||
|
||
here = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
alembic_args = [ | ||
'-c', os.path.join(here, 'alembic.ini'), | ||
'upgrade', 'head' | ||
] | ||
|
||
|
||
def main(): | ||
alembic.config.main(argv=alembic_args) |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,47 +1,50 @@ | ||
from sqlalchemy import FLOAT, INTEGER, TIMESTAMP, VARCHAR, Column, ForeignKey | ||
from sqlalchemy.orm import declarative_base, relationship | ||
from sqlalchemy import FLOAT, INTEGER, TIMESTAMP, VARCHAR, ForeignKey | ||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship | ||
from sqlalchemy.sql import func | ||
|
||
Base = declarative_base() | ||
|
||
class Base(DeclarativeBase): | ||
pass | ||
|
||
|
||
|
||
class Dataset(Base): | ||
__tablename__ = "dataset" | ||
|
||
id = Column(INTEGER, primary_key=True) | ||
name = Column(VARCHAR(50), nullable=False) | ||
num_rows = Column(INTEGER) | ||
num_columns = Column(INTEGER) | ||
created_at = Column(TIMESTAMP, default=func.now()) | ||
id: Mapped[int] = mapped_column(INTEGER, primary_key=True) | ||
name = mapped_column(VARCHAR(50), nullable=False) | ||
num_rows = mapped_column(INTEGER) | ||
num_columns = mapped_column(INTEGER) | ||
created_at = mapped_column(TIMESTAMP, default=func.now()) | ||
|
||
|
||
class Metric(Base): | ||
__tablename__ = "metric" | ||
|
||
id = Column(INTEGER, primary_key=True) | ||
name = Column(VARCHAR(50), nullable=False) | ||
category = Column(VARCHAR(50)) | ||
created_at = Column(TIMESTAMP, default=func.now()) | ||
id = mapped_column(INTEGER, primary_key=True) | ||
name = mapped_column(VARCHAR(50), nullable=False) | ||
category = mapped_column(VARCHAR(50)) | ||
created_at = mapped_column(TIMESTAMP, default=func.now()) | ||
|
||
|
||
class Version(Base): | ||
__tablename__ = "version" | ||
|
||
id = Column(INTEGER, primary_key=True) | ||
name = Column(VARCHAR(50), nullable=False, default="unversioned") | ||
created_at = Column(TIMESTAMP, default=func.now()) | ||
id = mapped_column(INTEGER, primary_key=True) | ||
name = mapped_column(VARCHAR(50), nullable=False, default="unversioned") | ||
created_at = mapped_column(TIMESTAMP, default=func.now()) | ||
|
||
|
||
class Result(Base): | ||
__tablename__ = "result" | ||
|
||
id = Column(INTEGER, primary_key=True) | ||
metric_id = Column(INTEGER, ForeignKey("metric.id")) | ||
dataset_id = Column(INTEGER, ForeignKey("dataset.id")) | ||
version_id = Column(INTEGER, ForeignKey("version.id")) | ||
value = Column(FLOAT) | ||
created_at = Column(TIMESTAMP, default=func.now()) | ||
id = mapped_column(INTEGER, primary_key=True) | ||
metric_id = mapped_column(INTEGER, ForeignKey("metric.id")) | ||
dataset_id = mapped_column(INTEGER, ForeignKey("dataset.id")) | ||
version_id = mapped_column(INTEGER, ForeignKey("version.id")) | ||
value = mapped_column(FLOAT) | ||
created_at = mapped_column(TIMESTAMP, default=func.now()) | ||
|
||
metric: Metric = relationship("Metric") | ||
dataset: Dataset = relationship("Dataset") | ||
version: Version = relationship("Version") | ||
metric: Mapped[Metric] = relationship("Metric") | ||
dataset: Mapped[Dataset] = relationship("Dataset") | ||
version: Mapped[Version] = relationship("Version") |
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
Binary file not shown.
Binary file not shown.
Oops, something went wrong.