Skip to content

Question: Using paracelsus with SQLAlchemy core #31

@berislavlopac

Description

@berislavlopac

I would like to inquire it would be possible to use Paracelsus with the SQLAlchemy core-based configurations, using the Table definitions instead of ORM.

To be more precise, I know that it can: since Paracelsus looks for the .metadata attribute on a Base class, I got the expected result from a configuration like this:

import sqlalchemy as sa

meta = sa.MetaData()

class Base:
    metadata = meta

test_table = sa.Table(
    "test_table",
    meta,
    sa.Column("id", sa.UUID, primary_key=True),
    sa.Column("name", sa.String(256)),
)
$ paracelsus graph database.tables:Base
erDiagram
  test_table {
    UUID id PK
    VARCHAR(256) name "nullable"
  }

It would be nice if we could have a CLI argument that would point to the metadata directly, i.e. something like paracelsus graph --meta database.tables:meta in the example above. Or even it can be automated by checking if the indicated object is already a MetaData instance before reverting to the original behaviour. 🤔

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions