Skip to content

Commit 6334ab9

Browse files
authored
Rename database to metastore (#7)
* Rename database to metadata Signed-off-by: kerthcet <kerthcet@gmail.com> * Rename database to metastore Signed-off-by: kerthcet <kerthcet@gmail.com> --------- Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent f4b2753 commit 6334ab9

9 files changed

Lines changed: 16 additions & 16 deletions

File tree

alphatrion/experiment/custom_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from alphatrion.database.sql_models import ExperimentStatus
1+
from alphatrion.metadata.sql_models import ExperimentStatus
22
from alphatrion.experiment.base import Experiment
33
from alphatrion.runtime.runtime import Runtime
44

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from abc import ABC
22

3-
class Database(ABC):
4-
"""Base class for all databases."""
3+
class MetaStore(ABC):
4+
"""Base class for all metadata storage backends."""
55
def __init__(self):
66
pass
77

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from sqlalchemy import create_engine
22
from sqlalchemy.orm import sessionmaker
33

4-
from alphatrion.database.base import Database
5-
from alphatrion.database.sql_models import Base, Experiment
4+
from alphatrion.metadata.sql_models import Base, Experiment
5+
from alphatrion.metadata.base import MetaStore
66

77

8-
# SQL-like database implementation, it could be SQLite, PostgreSQL, MySQL, etc.
9-
class SQLDatabase(Database):
8+
# SQL-like metadata implementation, it could be SQLite, PostgreSQL, MySQL, etc.
9+
class SQLStore(MetaStore):
1010
def __init__(self, db_url: str, init_tables: bool = False):
1111
super().__init__()
1212

alphatrion/runtime/runtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import os
22

33
from alphatrion import consts
4-
from alphatrion.database.sql import SQLDatabase
4+
from alphatrion.metadata.sql import SQLStore
55

66

77
class Runtime:
88
def __init__(self, project_id: str):
99
self._project_id = project_id
1010
# TODO: initialize the metadata database based on the URL.
11-
self._metadb = SQLDatabase(os.getenv(consts.METADATA_DB_URL), init_tables=True)
11+
self._metadb = SQLStore(os.getenv(consts.METADATA_DB_URL), init_tables=True)

tests/experiment/test_custom_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from alphatrion.database.sql_models import ExperimentStatus
5+
from alphatrion.metadata.sql_models import ExperimentStatus
66
from alphatrion import consts
77
from alphatrion.experiment.custom_exp import CustomExperiment
88
from alphatrion.runtime.runtime import Runtime
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import pytest
22

3-
from alphatrion.database.base import Database
3+
from alphatrion.metadata.base import MetaStore
44

5-
def test_database_abstract_methods():
6-
db = Database()
5+
def test_metadata_abstract_methods():
6+
db = MetaStore()
77

88
with pytest.raises(NotImplementedError):
99
db.create_exp("test", "test", "test", {})
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import pytest
2-
from alphatrion.database.sql import SQLDatabase
3-
from alphatrion.database.sql_models import ExperimentStatus
2+
from alphatrion.metadata.sql import SQLStore
3+
from alphatrion.metadata.sql_models import ExperimentStatus
44

55

66
@pytest.fixture
77
def db():
8-
db = SQLDatabase("sqlite:///:memory:", init_tables=True)
8+
db = SQLStore("sqlite:///:memory:", init_tables=True)
99
yield db
1010

1111

0 commit comments

Comments
 (0)