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

Request For Information: What are you using Supabase for? #424

Open
J0 opened this issue Apr 26, 2023 · 34 comments
Open

Request For Information: What are you using Supabase for? #424

J0 opened this issue Apr 26, 2023 · 34 comments

Comments

@J0
Copy link
Collaborator

J0 commented Apr 26, 2023

Hey,

One of the Python Maintainers here. I also happen to be on the Supabase team though I don't work on the Python library. One of the issues we're facing is that it's harder to make a case for the Python library and client library for other server side languages. One reason given is that server side libraries usually have an existing ORM that they can use unlike for client side library such as Flutter, JavaScript, or similar where the benefit obtained by using Postgrest is more obvious.

If you're reading this issue, could we trouble you to share more about what you're using the library for as well as the services you are using (e.g. Storage, Auth etc). Feature requests are also welcome (e.g. direct integration with Django, FastAPI)

We'll share this with the team for feedback.

@feliche93
Copy link

I am personally using it in a lot of data heavy scripts that I feel are quite painful to develop in ts/js. Especially if you do some data transformation with pandas, or I guess what's coming more llm kinda flows with langchain.

I love the interactive jupyter notebook approach of coding and developing data scripts, where I can quickly iterate and test any code against supabase, which is just way faster and smoother for me to do in python.

Regarding using traditional ORMs or this library, I really like the familiarity and alignment with the js sdk. It's very easy for me to switch context from js to python back and forth, since both work almost the same. Creating a client, calling insert, delete etc. is so similar that it's just nice and easy to work with. However, I have recently also been considering using pandas or other libraries, since it feels that this one is not used too heavily and some things like upsert or other important functions are not super well documented.

Hope this helps!

@J0 just curious, what other alternative would you use? E.g. is there a way to introspect the db and generate pydantic types from an existing db and use it with let's say sql alchemy. That's something I wanna do more research on!

@J0 J0 pinned this issue Apr 27, 2023
@turian
Copy link

turian commented May 5, 2023

I haven't started using supabase yet, but I have a handful of prototype projects I'd like to use it for.

In particular, I have a Django app (with Django ORM) that involves LLMs and progressive loading as the DB is updated.

I also have a FastAPI app using sqlalchemy, that also involves LLM and a cron process.

Those types of apps would be my main use cases, that I envision for Supabase. All upcoming projects are of these two molds. I use Python because I don't like JS, and because I come from an ML background.

@turian
Copy link

turian commented May 5, 2023

One more thing. I want filesystem support that is ergonomic. Because a lot of text blobs are too large to put in the database.

@dishwad
Copy link

dishwad commented May 14, 2023

I recently started a company where we're using LLMs for document analysis. I'm using FastAPI/Python and Supabase on the backend. Front end is Next.js. I was really excited about trying Supabase because I'm a big fan. I was especially excited that you can have auth essentially handled for you.

As I've been implementing some of our first features and CRUD operations using the supabase-py client library I'm starting to second guess myself. In my server-side code I setup these "DAOs" which act as an abstraction layer for calls made with supabase-py. Basically each DAO uses supabase-py select, insert, etc functions. I'm considering just scrapping what I have right now and just using an ORM like SQLAlchemy. Why not just connect to the DB directly rather than going through the extra network call & processing through postgREST that comes along with using supabase-py? It's not clear to me that supabase-py is actually solving any problems for me on the server. 😕

I'm very curious about how other people are thinking about this, specifically using FastAPI and Supabase together. Not sure what I'm gaining by using supabase-py in my stack. Seems like supabase-py would be better suited for the front end frameworks built on Python such as Streamlit or PyScript.

@anand2312
Copy link
Contributor

@dishwad You're right - not a lot of benefits to connecting to the database via postgrest. The one thing you should be getting by using supabsae-py is RLS but ironically enough that isn't working right now either (see #185 )

For anyone else seeing this - If anyone uses supabase realtime on a Python environment, could you also reply here explaining your use-cases, and whether you're working with asyncio or not. Thanks!

@benjamin-kirkbride
Copy link

I want to use it to hook the auth into Django, but the lack of docs makes that difficult..

@CareTiger
Copy link

CareTiger commented Jun 28, 2023

@J0 I am building an ai app. Our stack is NuxtJS, FastAPI and we want to use Supabase as a one-stop vendor - for auth, postgres, storage and pg_vector. we would love official support because pinecone is a real good option for us and once we start splitting up into best in class then all pieces are up for grabs (auth, db and storage). Realtime is not so important for us right now. (https://www.sicara.fr/blog-technique/how-to-choose-your-vector-database-in-2023)

@djbutler
Copy link

djbutler commented Jul 7, 2023

Maybe similar to @benjamin-kirkbride, I want to write my own Flask API for interacting with my Supabase Postgres database. But honestly, rather than using the supabase-py query language, I'd rather just write my own SQL via SQLAlchemy. The only thing I need is, I would like a way to take advantage of Supabase's RLS. It seems like that's not possible at the moment. I'm studying the other Supabase services, and it seems like basically what you need to do is make some "set_config" calls at the beginning of every connection to the db, to set JWT information. Just having some code to generate that SQL for me would be great.

@benjamin-kirkbride
Copy link

@djbutler have you seen this: https://supabase.com/docs/guides/auth/row-level-security#testing-policies

This is where I would if I were trying to do what you described. It's not everything, but it gets you a lot of the way there.

@CareTiger
Copy link

To add to some of the comments posted today, there are so many examples on YouTube and in github repos for Supabase Edge functions. It would be nice if this library gets a little more love. I would like to see some examples of using Supabase auth with fastapi and handling user sessions and bearer tokens. Also examples of using pg_vector would be very helpful. thanks

@djbutler
Copy link

djbutler commented Jul 8, 2023

Ah okay that's perfect, thanks @benjamin-kirkbride. So I guess the logic for my Flask endpoints could go something like this:

  1. Decode the JWT and verify that it's still valid.
  2. Extract the user's email address from the JWT.
  3. Send some SQL code to the db that looks like call auth.login_as_user({user_email});
  4. Perform my main SQL query.
  5. Send SQL code that looks like call auth.logout();.

It's not a way that I've interacted with a SQL db before, but it seems reasonable. Curious how this will interact with transactions - for instance, whether it's better to call login_as_user before or after the transaction has begun.

At any rate, this is the type of functionality I want. Seems quite simple. Just having some docs on the Supabase website to show how to do this would be great.

@CareTiger
Copy link

To add to some of the comments posted today, there are so many examples on YouTube and in github repos for Supabase Edge functions. It would be nice if this library gets a little more love. I would like to see some examples of using supabase auth with fastapi and handling user sessions and bearer tokens. Also examples of using pg_vector would be very helpful. thanks

@CareTiger
Copy link

@J0 The community seems to have given a lot of constructive feedback but we haven't heard back from you or Supabase. Could you please give us an update? Thank you

@djbutler
Copy link

djbutler commented Jul 12, 2023 via email

@CareTiger
Copy link

CareTiger commented Jul 15, 2023

@J0 is it fair to say that Supabase would prefer to have this module maintained for free by the community and people like @anand2312 and not spend those venture dollars on actually building something customers want?

@J0
Copy link
Collaborator Author

J0 commented Jul 15, 2023

Hey @CareTiger,

Apologies for the delayed response and if it came across as though I was ignoring the messages - I tend to check the repository mainly on the weekend and I do miss messages. Sorry about that - I'll try to clear out my notifications. On the general front, we have hired someone to work on the Python libraries by starting with a set of core client and other shared features which will help control timeouts, RLS.

Additionally, we are also looking into a per framework set of helpers (e.g. django-postgrest-supabase, fastapi-postgrest-supabase) which can emulate the RLS behaviour performed by Postgrest. I'll post the RFC when a slot frees up.

Finally, we also added vecs a library for interacting with embeddings stored in pg vector this should help in some way for those building AI applications

Let me reply the rest of the issues in the thread sequentially.

@J0
Copy link
Collaborator Author

J0 commented Jul 15, 2023

Those types of apps would be my main use cases, that I envision for Supabase. All upcoming projects are of these two molds. I use Python because I don't like JS, and because I come from an ML background.

Would an quickstart with say, next.js or similar as frontend and FastAPI as backend be something that's of interest to people?

@J0
Copy link
Collaborator Author

J0 commented Jul 15, 2023

I want to use it to hook the auth into Django, but the lack of docs makes that difficult..
One other general thought: be nice to have more docs on building extra
backend services that play nicely with the Supabase ecosystem.

Adding as feedback for the team

I'm studying the other Supabase services, and it seems like basically what you need to do is make some "set_config" calls at the beginning of every connection to the db, to set JWT information. Just having some code to generate that SQL for me would be great.

That makes sense, we're hoping the per-framework helper library will be able to assist with that. Do let us know your thoughts on the RFC when it is out

@J0
Copy link
Collaborator Author

J0 commented Jul 15, 2023

would like to see some examples of using supabase auth with fastapi and handling user sessions and bearer tokens
This is a good suggestion, will log as feedback as well

Also examples of using pg_vector would be very helpful.

For general PGVector content you can take a look at this Supabase tips edition. Feel free to also check out the vecs documentation on interacting with embeddings

examples on YouTube and in github repos for Supabase Edge functions. It would be nice if this library gets a little more love.

With regards to edge functions, are there any specific examples that you would like to see or would it be more of a general video showcasing how to use the library?

@J0
Copy link
Collaborator Author

J0 commented Jul 15, 2023

The Python community is important to us and we do wish for the developer experience to improve - it is just the case that there are a few other pressing issues that we need to resolved before we can come back and tackle this (e.g. improved resilience for databases, enhanced environment management, and better DX for building AI applications)

Hope this provides more context in some way and do feel free to write back if there are further queries or concerns.

@CareTiger
Copy link

yes. I would be very interested in this. Even better if you use Nuxt JS, but Next JS is fine. I am more interested in the FastAPI - Supabase part. Especially protected routes using JWT, managing sessions, and async calls to the database for CRUD.

@djbutler
Copy link

Those types of apps would be my main use cases, that I envision for Supabase. All upcoming projects are of these two molds. I use Python because I don't like JS, and because I come from an ML background.

Would an quickstart with say, next.js or similar as frontend and FastAPI as backend be something that's of interest to people?

Yep exactly! Just something to make it a bit quicker and easier to write custom backends.

@djbutler
Copy link

djbutler commented Jul 16, 2023

yes. I would be very interested in this. Even better if you use Nuxt JS, but Next JS is fine. I am more interested in the FastAPI - Supabase part. Especially protected routes using JWT, managing sessions, and async calls to the database for CRUD.

Agreed. The NextJS part is pretty well covered already - it's the backend part that needs some love.

@mardadi23
Copy link

Let’s solve some basics first for the python library by supporting the vecs schéma for selects and rpcs etc.

@OpenSourceIronman
Copy link

I am building a network connected smart tiny home app, using NiceGUI, FastAPI, and Paramiko on a ZimaBoard server running inside the tiny home. We want to use Supabase for auth and postgres storage (for things like light and door lock state and a list of network connected devices currently on the network for each user/home). We are a new start-up called Mammoth Factory Corp in Marianna, Florida looking to build 100 tiny homes in the next 6 months.

Goal is to allow a user can control the entire house from their phone (or locally without an internet connection on a large touch screen). We would like to use supabase; however, we had to lock NiceGUI to version 1.3.0 to find a valid httpx version that would work. (0.24.0 in our case).

The conflict is caused by:
nicegui 1.3.4 depends on httpx<0.25.0 and >=0.24.1
postgrest 0.10.6 depends on httpx<0.24.0 and >=0.23.0

@J0
Copy link
Collaborator Author

J0 commented Jul 20, 2023

Hey @mardadi23,

If it's not too trouble do you mind opening an issue on Supabase vecs with more info about what an ideal experience would look like for you? Have given the maintainer a heads up that there are requests

Hey @OpenSourceIronman,

We're aware of the issue and are looking into it there's currently an issue with the tests breaking with the upgrade, possibly due to a change in encoding by httpx. If anyone would like to jump in please feel do so, otherwise will look at it when a slot frees up.

Thanks!

@krisbitney
Copy link

With https://polywrap.io you can write it once and use it on Python, JavaScript, Rust, Kotlin, and Swift

Amazing tech, and Web3 friendly!

@ShantanuNair
Copy link
Contributor

Building exemplary.ai's AI/ML backend. We use vector stores and the langchain python lib. Because the python sdk for supabase is somewhat lacking (wrt JS/TS sdk), I am sure there is a huge swathe of people using langchain python and who looked at supabase but with an alternate vector db/something else despite supabase being so much more than that. At this point, with what's happening with LLMs and everything around it, I think supabase should indeed invest more into their python tooling beyond vecs, and get supabase-py on par with the TS/JS version or at least basic features such as RPC calls should work ootb.

Appreciate all your work @J0

@tadasajon
Copy link

I landed here because I'm looking for a way to do direct integration with Django.

Django is so mature and established that AI can work with Django easily, and I also happen to love the ORM, but my main concern when building an app is getting a reliable and powerful Postgres foundation, which is why I want to use Supabase.

Also, Python is a great language for doing so many diverse things that an app may need to do, such as background jobs and various integrations and calculations, that I want Python in my stack anyway.

@tadasajon
Copy link

I want to use it to hook the auth into Django, but the lack of docs makes that difficult.

This is exactly what I want to do -- I want Django auth working on the Supabase auth foundation

@JacobJNilsson
Copy link

Hi @J0,

I'm using supabase both with js and python. js for a frontend web app, and python to work with data, with which I populate a database in supabase to be viewed by the frontend.

My biggest annoyance is that the js client has a lot of nice helpful methods that the python client are lacking. Mostly small stuff, like overlaps() and others.

Super happy overall though, keep up the great work!

@NixBiks
Copy link

NixBiks commented Nov 2, 2023

For anyone else seeing this - If anyone uses supabase realtime on a Python environment, could you also reply here explaining your use-cases, and whether you're working with asyncio or not. Thanks!

@anand2312 I would like to use supabase realtime in a python environment. I use it to notify workers if they need to add new jobs to run, or stop running jobs they are doing. Is it currently possible to listen for realtime changes in supabase python?

@silentworks
Copy link
Contributor

So many amasing use cases here and so much love being shown for the Python client. I've been working on the Python clients recently and hope to get them on par with the JavaScript library soon. I am also creating content around this in the form of tweets and blog posts. My current main focus is now the realtime client as I think all the other clients are at a really good working state.

@nileshtrivedi
Copy link

It's high time the Python client for supabase is given official blessing and support. Python ecosystem is moving really fast (especially due to AI/ML) and not being officially supported makes it more and more risky for me to choose Supabase for new projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests