1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Supabase python client returns an empty list when making a query

Discussão em 'Python' iniciado por Stack, Setembro 10, 2024.

  1. Stack

    Stack Membro Participativo

    My configuration is very basic. A simple supabase database with one table.

    I use supabase-py to interact with it. The problem is that I always get an empty list :

    from supabase import create_client

    URL = "MY_URL_HERE"
    API_KEY = "MY_API_KEY_HERE"

    supabase = create_client(URL, API_KEY)

    response = supabase.table("prod_vxf").select("*").execute()

    print(respnse.data)
    # []


    After checking some similar topics like this one, it seems that the only solution is by turning off RLS. So I went to the dashboard and turned off the RLS for the table prod_vxf and it worked. Now, the code above gives a non empty list :

    print(response.data)
    [
    {"id": 1, "created_at": "2024-01-01T00:00:00+00:00"},
    {"id": 2, "created_at": "2024-01-02T00:00:00+00:00"},
    {"id": 3, "created_at": "2024-01-03T00:00:00+00:00"},
    ]


    But what is very confusing is the warning below that hits my screen when I try to turn off the RLS for a given table in supabase dashboard. Does it mean that anyone on the internet (even without knowing url + api key) can access (read and write) my database and its tables ? Honestly, I'm super confused by the term publicly used by the warning.

    [​IMG]

    Continue reading...

Compartilhe esta Página