supabase / postgres-meta

A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries
https://supabase.com
Apache License 2.0
941 stars 126 forks source link

Generating types in python format #795

Open dhruvmalik007 opened 4 months ago

dhruvmalik007 commented 4 months ago

Is your feature request related to a problem? Please describe.

I was following the tutorial for generating the database types for supabase here , so I thought normally this command can be adapted for the python in order to generate the corresponding types in python objects

Describe the solution you'd like

to include the command

npx supabase gen types python --project-id "$PROJECT_REF" --schema public > types.py should generate the types in the python.

Describe alternatives you've considered converting the types generated in ts into py ;) . Additional context N.A

sweatybridge commented 4 months ago

Type generation is handled mostly in https://github.com/supabase/postgres-meta/tree/master/src/server/templates where you can see a list of supported type templates.

If you would like to contribute a new language, we will be more than happy to review your PR.

Mohmn commented 4 months ago

Could you please assign this issue to me? I find it very interesting t. Also, could you guide me on anything I need to know to get started? Any specific instructions or resources would be greatly appreciated

dhruvmalik007 commented 4 months ago

thanks @Mohmn for the response . my bad for late response but yeah I understood we will have to define the generator types and the wrapped call functions in order to pythonic format.

but yeah right now I have my plate full in terms of time dedication , so if you want to contribute please feel free to do that.

TopIvanAbramov commented 2 months ago

Generating types in Python will be really helpfull

faroukcharkas commented 2 months ago

python types would actually be incredible, having a built in almost-ORM? with supabase would be wild

urieltfk commented 2 months ago

Please, this would be amazing.

antopiahk commented 2 months ago

Please, this would be beyond amazing.

nikita-olechko commented 2 months ago

Wrote a small implementation for Python here:

https://github.com/nikita-olechko/Supabase-Table-Type-Definitions-In-Python/blob/main/README.md

Far from comprehensive, but works.

ryanpeach commented 1 month ago

Here is my suggestion for the output format https://github.com/supabase/postgres-meta/pull/808

I don't think it will be hard to modify the go file to do this for python.