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

    anand

    05/08/2022, 6:00 PM
    (sorry i went offline in between) to change the timeout for the database client you can do
    Copy code
    py
    supabase.postgrest.session.timeout = x
    where
    supabase
    is defined as you had shown in the earlier snippet
  • b

    ben

    05/08/2022, 6:00 PM
    Awesome thanks! I'll give that a shot
  • b

    ben

    05/08/2022, 6:00 PM
    Is x in seconds or ms?
  • a

    anand

    05/08/2022, 6:01 PM
    seconds i believe. it's just the timeout arg for the httpx clientsession https://www.python-httpx.org/quickstart/#timeouts
  • b

    ben

    05/09/2022, 8:05 PM
    This worked! My timeout issue is on the upstream server now lol
  • a

    anand

    05/10/2022, 3:08 AM
    Haha
  • a

    anand

    05/10/2022, 3:31 AM
    You could try connecting directly to the database with something like psycopg2/asyncpg and write SQL to insert your dataset now, and then use supabase-py to do the simpler queries
  • a

    anand

    05/10/2022, 3:31 AM
    You can find the db connection string in the project settings
  • n

    nitehawk

    05/29/2022, 7:05 PM
    https://supabase.com/docs/reference/javascript/auth-api-getuser#fetch-the-user-object-using-the-access_token-jwt= is there a way to do this using the python sdk?
    m
    • 2
    • 3
  • m

    mansueli

    05/30/2022, 12:23 PM
    getUser() | Supabase
  • z

    zachtsk

    06/07/2022, 1:44 PM
    Does anyone have experience using Supabase as a database with Django on GCP? I'm able to connect to the database locally, but when I deploy to Google App Engine I get a HTTP 500 error. For additional context, when I swapped out the connection with a different postgres instance (digital ocean) I am able to connect from my app engine environment without making any other changes. I'm assuming it has something to do with with the SSL cert, but app engine uses SSL by default, so not sure what other avenues to test.
    m
    s
    • 3
    • 5
  • m

    mansueli

    06/07/2022, 4:45 PM
    Does anyone have experience using
  • p

    ProtoFeather

    06/11/2022, 5:38 PM
    Hello all, How do you guys handle database error in python? I’m getting a “key already exists error” (which is wanted) but from that I’d like to make an if statement. How’d I go about that?
    z
    a
    • 3
    • 13
  • z

    zachtsk

    06/11/2022, 6:47 PM
    Hello all
  • a

    ak4zh

    06/19/2022, 7:19 AM
    how to get all items from a table where a column is null.
    supabase.table('vehicles').select('id').is('deleted', None).execute()
    python library does not seem to support the
    .is
    like in subabase-js
    m
    d
    • 3
    • 5
  • m

    mansueli

    06/20/2022, 1:19 PM
    how to get all items from a table where
  • z

    zavbala

    07/01/2022, 4:17 PM
    What's the correct approach to set a timestamp from python? Use datetime?
    m
    • 2
    • 2
  • z

    Zomg

    07/08/2022, 12:06 PM
    i'm trying to use supabase for my tiny discord bot, and am currently testing it to see if it works, but for some reason, even though i put some sample data in my table, the request always comes up empty
    Copy code
    py
    supabase = supabase.create_client(url, key)
    data = supabase.table("lengths").select("*").execute()
    print(data.data)
    output: [] looking at the api logs, the requests are successful, it's just not giving any data
  • g

    garyaustin

    07/08/2022, 3:21 PM
    Don't use any of your environment, but that is what would happen if you are not meeting RLS policy.
  • z

    Zomg

    07/08/2022, 3:25 PM
    how would i set up an RLS policy that would only allow me to modify the table?
  • g

    garyaustin

    07/08/2022, 3:30 PM
    If you want to only modify from the dashboard then just turn on RLS and don't have an insert or update policy. You would need a select policy for users to select your data. Either true for all or select specific roles
  • z

    Zomg

    07/08/2022, 3:31 PM
    nah i'm looking to insert/update values with the bot
  • g

    garyaustin

    07/08/2022, 3:42 PM
    I don't know enough about bots to say. If you can safely use service role key (it can't be seen in the code by users) then that would work. Next would be having to generate a user for the bot and deal with signing/refreshing etc. There may be other ways using an extra row with a code you can include in the insert or with headers.
  • z

    Zomg

    07/08/2022, 3:46 PM
    yeah my code is closed source, will look into the service role key, thanks
  • p

    pedrodiaz

    07/12/2022, 5:33 PM
    I created a PR for providing an interface similar to this one https://supabase.com/docs/reference/javascript/auth-update#notes
  • p

    pedrodiaz

    07/12/2022, 5:33 PM
    for gotrue client
  • c

    Chubbyman

    07/21/2022, 2:24 AM
    Hi there, I'm currently using Supabase to try and upload a .txt file to a public bucket named "training-data", but for some reason, it's giving me this error:
    Copy code
    storage3.utils.StorageException: {'statusCode': 400, 'error': 'Key is not present in table "buckets".', 'message': 'insert or update on table "objects" violates foreign key constraint "objects_bucketId_fkey"'}
    I made sure to create all the necessary object policies to allow for insertion, as well as make the bucket itself public. Here is my code:
    Copy code
    py
    from supabase import create_client
    from dotenv import load_dotenv
    import os
    
    load_dotenv()
    url = os.environ.get("DEPLOY_URL")
    key = os.environ.get("DEPLOY_KEY")
    
    
    supabase = create_client(url, key)
    
    file = "test.txt"
    # data = supabase.storage().from_("public/training-data").download("test.txt")
    # print(data)
    
    supabase.storage().from_("public/training-data").upload("test.txt", file)
    If anyone has any suggestions, please let me know.
  • c

    Chubbyman

    07/21/2022, 2:26 AM
    FYI, when I manually upload "test.txt" to the bucket then try to download it (using the commented-out lines), it works, so I know it's not an authentication problem.
  • f

    FestiveLlama

    07/27/2022, 10:10 AM
    Hiya! Is there documentation for python and Django? I’m currently learning Django and want to know if I can do database connection with supabase instead of the default SQLite?
    s
    • 2
    • 2
  • s

    silentworks

    07/27/2022, 4:22 PM
    Using Supabase as a Database with Django
1...1516171819Latest