OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Insert data to supabase with python

  • Thread starter Thread starter Quinten
  • Start date Start date
Q

Quinten

Guest
I would like to import some data to a supabase using Python. I followed the documentation like here, which suggests that we can use the supabase.table attribute to .insert data. I tried the following code which doesn't work:

Code:
import supabase

response = (
    supabase.table("user_results")
    .insert({"id": 1, "Date": "Denmark",
             "Race": "1",
             "Track": "Mario Kart Stadium",
             "Finish": "1"})
    .execute()
)

Output:

Code:
AttributeError: module 'supabase' has no attribute 'table'

I do understand the error, but I don't understand why this is not working. I find it really confusing how we can simply insert some data to a supabase using python. So I was wondering if anyone knows how to insert data to a supabase?



For reference, my database looks like this in supabase:

enter image description here
<p>I would like to import some data to a <code>supabase</code> using Python. I followed the documentation like <a href="https://supabase.com/docs/reference/python/insert" rel="nofollow noreferrer">here</a>, which suggests that we can use the <code>supabase.table</code> attribute to <code>.insert</code> data. I tried the following code which doesn't work:</p>
<pre><code>import supabase

response = (
supabase.table("user_results")
.insert({"id": 1, "Date": "Denmark",
"Race": "1",
"Track": "Mario Kart Stadium",
"Finish": "1"})
.execute()
)
</code></pre>
<p>Output:</p>
<pre><code>AttributeError: module 'supabase' has no attribute 'table'
</code></pre>
<p>I do understand the error, but I don't understand why this is not working. I find it really confusing how we can simply insert some data to a supabase using python. So I was wondering if anyone knows how to insert data to a supabase?</p>
<hr />
<p>For reference, my database looks like this in supabase:</p>
<p><a href="https://i.sstatic.net/65AHt73B.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/65AHt73B.png" alt="enter image description here" /></a></p>
 

Latest posts

Z
Replies
0
Views
1
zuegelwagen
Z
Top