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

🚚 Rename DObject to File and DFolder to Folder #146

Merged
merged 11 commits into from
Mar 24, 2023
Merged
32 changes: 16 additions & 16 deletions docs/guide/1-data-validation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
"source": [
"import nbproject as nb\n",
"import pytest\n",
"from lnschema_core import DObject, Transform, Run\n",
"from lnschema_core import File, Transform, Run\n",
"from lnschema_core.dev.sqlmodel import SQLModelPrefix\n",
"from sqlmodel import Relationship, Field, ForeignKeyConstraint\n",
"from typing import Optional\n",
Expand Down Expand Up @@ -381,7 +381,7 @@
"source": [
"# relationship validation works correctly (strict type checking, valid model)\n",
"with pytest.raises(TypeError):\n",
" dobject = DObject(source=Transform(name=\"My test pipeline\"))"
" file = File(source=Transform(name=\"My test pipeline\"))"
]
},
{
Expand All @@ -391,14 +391,14 @@
"outputs": [],
"source": [
"# relationship validation works correctly (strict type checking, resolved ForwardRef)\n",
"class DObjectRel(SQLModelPrefix, table=True):\n",
"class FileRel(SQLModelPrefix, table=True):\n",
" id: str = Field(primary_key=True, default=None)\n",
" dobject_id: Optional[str] = Field(foreign_key=\"core.dobject.id\", index=True)\n",
" dobject: Optional[\"DObject\"] = Relationship()\n",
" file_id: Optional[str] = Field(foreign_key=\"core.file.id\", index=True)\n",
" file: Optional[\"File\"] = Relationship()\n",
"\n",
"\n",
"dobject = DObject(name=\"mydobject\", source_id=\"raf\", storage_id=\"g4s\")\n",
"dobject_real = DObjectRel(dobject=dobject)"
"file = File(name=\"myfile\", source_id=\"raf\", storage_id=\"g4s\")\n",
"file_real = FileRel(file=file)"
]
},
{
Expand All @@ -408,14 +408,14 @@
"outputs": [],
"source": [
"# auto-population of required fk constraints works correctly\n",
"class DObjectRelFK(SQLModelPrefix, table=True):\n",
"class FileRelFK(SQLModelPrefix, table=True):\n",
" id: str = Field(primary_key=True, default=None)\n",
" dobject_id: str = Field(foreign_key=\"core.dobject.id\", index=True)\n",
" dobject: DObject = Relationship()\n",
" file_id: str = Field(foreign_key=\"core.file.id\", index=True)\n",
" file: File = Relationship()\n",
"\n",
"\n",
"dobject = DObject(name=\"mydobject\", source_id=\"raf\", storage_id=\"g4s\")\n",
"dobject_rel = DObjectRelFK(dobject=dobject)\n",
"file = File(name=\"myfile\", source_id=\"raf\", storage_id=\"g4s\")\n",
"file_rel = FileRelFK(file=file)\n",
"\n",
"\n",
"# auto-population of required fk constraints works correctly (composite fk)\n",
Expand All @@ -437,9 +437,9 @@
"metadata": {},
"outputs": [],
"source": [
"# dobject validation works correctly (missing field errors are raised even when dobject is instantiated with custom constructor)\n",
"# file validation works correctly (missing field errors are raised even when file is instantiated with custom constructor)\n",
"with pytest.raises(ValidationError):\n",
" dobject = DObject(name=\"no data objects\")"
" file = File(name=\"no data objects\")"
]
},
{
Expand All @@ -448,8 +448,8 @@
"metadata": {},
"outputs": [],
"source": [
"# dobject validation works correctly (no errors raised when dobject is conformantly instantiated with custom constructor)\n",
"dobject = DObject(name=\"mydobject\", source_id=nb.meta.store.id, storage_id=\"123\")"
"# file validation works correctly (no errors raised when file is conformantly instantiated with custom constructor)\n",
"file = File(name=\"myfile\", source_id=nb.meta.store.id, storage_id=\"123\")"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions lnschema_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
.. autosummary::
:toctree: .

DObject
File
Run
Transform
DFolder
Folder
User
Storage
Project
Expand All @@ -33,8 +33,8 @@
"""
_schema_id = "yvzi"
_name = "core"
_migration = "ebafd37fd6e1"
_migration = "5846a15d9241"
__version__ = "0.30rc2"

from . import dev, link
from ._core import DFolder, DObject, Features, Project, Run, Storage, Transform, User
from ._core import Features, File, Folder, Project, Run, Storage, Transform, User
Loading