diff --git a/README.md b/README.md index e65b7f9..bafcff3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ # dbml-builder Generates Pydantic and SQLAlchemy from a DBML file. + +## Usage + +Install using pip: + +``` +pip install dbml_builder +``` + +Generate your ORM and schemas by running: + +``` +model-build generate ./project.dbml src/generated +``` +or call `generate_models` directly in Python code. + +You can check to if the model code is still valid by running: +``` +model-build check v0.9.3 src/generated +``` +or call `verify` directly in Python code. + diff --git a/dbml_builder/__init__.py b/dbml_builder/__init__.py index 8adf07e..e7a92c2 100644 --- a/dbml_builder/__init__.py +++ b/dbml_builder/__init__.py @@ -1 +1 @@ -from build import get_dbml_version, verify, generate_validation +from dbml_builder.build import get_dbml_version, verify, generate_models diff --git a/dbml_builder/build.py b/dbml_builder/build.py index 2ba118e..e661ff3 100644 --- a/dbml_builder/build.py +++ b/dbml_builder/build.py @@ -14,7 +14,7 @@ from os.path import exists, join from pathlib import Path -from fix import patch +from dbml_builder.fix import patch INFO = 'info.json' SCHEMAS = 'schema.py' @@ -54,7 +54,7 @@ def verify(version: str, generated_dir: str) -> bool: return False -def generate_validation(dbml_path: str, generated_dir: str) -> None: +def generate_models(dbml_path: str, generated_dir: str) -> None: """ Generate model code from DBML diff --git a/dbml_builder/cli.py b/dbml_builder/cli.py index 91553d1..5145b27 100644 --- a/dbml_builder/cli.py +++ b/dbml_builder/cli.py @@ -4,7 +4,7 @@ from click import argument, echo, group -from build import generate_validation, verify +from dbml_builder.build import generate_models, verify @group() def main() -> None: @@ -36,7 +36,7 @@ def generate(path_to_dbml: str, path_to_generated_dir: str) -> None: `gen` should only be called when developing using a new version of the DBML. """ - generate_validation(path_to_dbml, path_to_generated_dir) + generate_models(path_to_dbml, path_to_generated_dir) echo('Generated pydantic schemas') diff --git a/pyproject.toml b/pyproject.toml index 6b37217..8e3caa5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,12 @@ [tool.poetry] name = "dbml-builder" -version = "0.1.0" +version = "0.1.4" description = "" authors = ["Five Grant "] readme = "README.md" packages = [{include = "dbml_builder"}] -repository = "https://github.com/jataware/dbml-builder" +license = "MIT" +keywords = ["dbml", "sql"] [tool.poetry.urls] "Bug Tracker" = "https://github.com/jataware/dbml-builder/issues"