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

Fully wrapped supabase-js working (I think) #478

Open
bitnom opened this issue Jun 24, 2023 · 1 comment
Open

Fully wrapped supabase-js working (I think) #478

bitnom opened this issue Jun 24, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@bitnom
Copy link

bitnom commented Jun 24, 2023

Since a lot is missing (For me, realtime), I tried this:

import os
import asyncio
from javascript import require

url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_KEY")
supa_id = os.environ.get("SUPABASE_ID")


def callback1(*args, **kwargs):
    print("Callback: ", args)


async def main() -> None:
    createClient = require("@supabase/supabase-js").createClient
    supabase = createClient(url, key)
    supabase \
        .channel('any') \
        .on('postgres_changes', {
        'event': '*',
        'schema': 'public',
        'table': '*'
    }, callback1) \
        .subscribe()
    while True:
        await asyncio.sleep(1)


if __name__ == "__main__":
    asyncio.run(main())

and it worked quite well! I haven't tested every feature yet but it's doing what I need it to at the moment. Might be worth mentioning in the readme.

@J0 J0 added the documentation Improvements or additions to documentation label Sep 8, 2023
@knowsuchagency
Copy link

Good god what is this dark magic? I had never heard of that library. I love it

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

No branches or pull requests

3 participants