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

Specify database schema using python objects instead yaml file #168

Open
khoroshevskyi opened this issue Mar 4, 2024 · 1 comment
Open
Assignees
Labels

Comments

@khoroshevskyi
Copy link
Member

It would be awesome to specify database schemas using Python objects, such as classes or methods. I believe this approach could enhance the user experience because Python objects are easier to write and can help catch errors more effectively

@nsheff
Copy link
Contributor

nsheff commented Mar 12, 2024

I think I can see what you mean. A potential problem with this is that then the schema is only useful within Python...

I guess the way we're doing it now is that you write a JSON-schema, and then we convert that into Pydantic objects. So, I suppose it wouldn't be hard to also allow the other direction: user starts from a Pydantic model. I guess you would just create a ParsedSchema object from a pydantic model. It's probably even easier to do than coming from the JSON-schema.

I think there are then also ways to go from those models to a JSON-schema, in case you need a file-based representation...

And in fact, for pipestat, we do need a file-based representation.

So I think the way to approach this would be to just show people how to do Pydantic-to-JSON-Schema, which should be simple. So then you can write your schema with Python objects, save them to JSON schema, and then pass this to pipestat.

@donaldcampbelljr donaldcampbelljr added this to the v0.10.0 milestone Apr 19, 2024
@donaldcampbelljr donaldcampbelljr removed this from the v0.10.0 milestone Apr 23, 2024
@donaldcampbelljr donaldcampbelljr added the enhancement New feature or request label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants