https://supabase.com/ logo
Join Discord
Powered by
# python
  • k

    ktosiek

    12/22/2021, 6:18 PM
    is the postgrest module functional? It looks like client.postgrest.from_('table').select('column').execute() generates a wrong URL (without the '/table')
  • d

    dreinon

    12/25/2021, 12:39 PM
    Hey! It should be, yes
  • d

    dreinon

    12/25/2021, 12:40 PM
    Try installing the latest supabase-py version by running:
    pip install supabase
  • k

    ktosiek

    12/25/2021, 1:09 PM
    I'm using the develop branch, and it seems to work now
  • d

    dreinon

    12/25/2021, 1:10 PM
    awesome! We are about to release a new version, we'll announce it here 🙂
  • k

    ktosiek

    12/25/2021, 2:38 PM
    How should I save and reuse the refresh_token with Python client? It looks like there's no API like the JS's
    .signIn({refreshToken: ...})
  • k

    ktosiek

    12/25/2021, 2:46 PM
    nvm,
    supabase.auth._call_refresh_token(...)
    should work for now ^_^
  • d

    dreinon

    12/25/2021, 2:46 PM
    private methods shouldn't be accessed though, but if it works for you as a temporal solution
  • d

    dreinon

    12/25/2021, 2:47 PM
    @User will be able to answer your question better when he finds a bit of time, you know, rough days 🙂
  • k

    ktosiek

    12/25/2021, 2:54 PM
    It's just a demo (Supabase registration and login from Streamlit), so anything that works is good enough ^_^
  • d

    dreinon

    12/25/2021, 2:55 PM
    alright 😄
  • l

    leynier

    12/25/2021, 3:11 PM
    Currently there is a feature parity between the Javascript and Python GoTrue client libraries, so
    sign_in(refresh_token=...)
    works, which requires a gotrue-py update to be released soon. Meanwhile you can directly use the library from GitHub.
  • k

    ktosiek

    12/25/2021, 3:29 PM
    Oh, I see it in the repo! Thank you!
  • k

    ktosiek

    12/25/2021, 3:30 PM
    so all I need to do is wait for that code to get released as a version ^_^
  • a

    aUnicornDev

    12/26/2021, 9:30 AM
    Hi, I tried to run
    supabase.table('TABLE_NAME').select('*').eq('COLUMN_1',VARIABLE).order('COLUMN_2').execute()
    in python supabase client .. But got an error
    Copy code
    "QueryParams are immutable since 0.18.0. "
    RuntimeError: QueryParams are immutable since 0.18.0. Use `q = q.set(key, value)` to create an updated copy.
  • k

    ktosiek

    12/26/2021, 10:59 AM
    can you try with the develop branch?
    pip install git+https://github.com/supabase-community/supabase-py@develop#egg=supabase
  • k

    ktosiek

    12/26/2021, 11:05 AM
    oh, nevermind, looks like
    .order()
    is still broken :-C
  • k

    ktosiek

    12/26/2021, 11:10 AM
    It's a known bug: https://github.com/supabase-community/postgrest-py/issues/43
  • a

    aUnicornDev

    12/26/2021, 3:06 PM
    Thanks a lot for looking into it. I'll try to reorder after getting the data in FastAPI..
  • a

    Arjun Dave

    12/27/2021, 9:00 AM
    Hey, I was able to connect my django application to supabase. But I am having trouble connecting it to the storage. Can anyone tell me how to connect my django application to supabase storage
  • b

    beru

    12/27/2021, 11:12 AM
    Not sure if it's in the python library yet but usually it's through
    supabase.storage
  • j

    J0

    12/27/2021, 4:52 PM
    Hey, thanks for the question Arjun! As beru has mentioned you can use the existing python client library via
    supabase.storage
    to perform bucket/file operations. Could you give more details on what operations you would like to perform? I'm also currently writing a custom backend so that we can integrate with django-storages: https://github.com/jschneier/django-storages/issues/1099 so that you can just
    pip3 install django-storages
    and use Supabase as a Custom Storage backend but that will take a few more days.
  • a

    Arjun Dave

    12/28/2021, 3:57 AM
    Ok thanks, I will try this
  • a

    Arjun Dave

    12/28/2021, 3:57 AM
    I want to be able to store files and photos to show in my django web app
  • j

    J0

    12/28/2021, 4:50 AM
    oh yeah you can definitely do that. Will follow up with some brief instructions soon...
  • a

    Arjun Dave

    12/28/2021, 8:55 AM
    Ok, Thanks!
  • j

    J0

    12/28/2021, 4:30 PM
    Hey Arjun, So you can initialize a client as per normal via:
    Copy code
    python
    import os
    from supabase import create_client, Client
    
    url: str = os.environ.get("SUPABASE_URL")
    key: str = os.environ.get("SUPABASE_KEY")
    supabase: Client = create_client(url, key)
    storage = supabase.storage()
    From here you can then do
    Copy code
    storage.StorageFileAPI(<your_bucket_name)
    and then perform your desire operations
  • j

    J0

    12/28/2021, 4:30 PM
    for instance it would be
    Copy code
    python
    storage.StorageFileAPI(<your_bucket_name).download(<path>)
    to download a file you have uploaded to supabase storage
  • j

    J0

    12/28/2021, 4:31 PM
    You can view: https://github.com/supabase-community/supabase-py/blob/develop/supabase/lib/storage/storage_file_api.py for the rest of the file operations. The client is quite rough so you might run into some errors so feel free to post here or on the issues page if you face any problems. Thanks!
  • a

    Arjun Dave

    12/29/2021, 2:51 PM
    Thank you so much!
1...91011...19Latest