File size: 561 Bytes
cc146e8
 
 
 
 
 
 
 
 
 
 
a1b4828
 
 
b517c9a
a1b4828
cc146e8
 
a1b4828
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import streamlit as st
from supabase import create_client

@st.cache_resource
def init_supabase():
    url = os.getenv("SUPABASE_URL")
    key = os.getenv("SUPABASE_KEY")
    return create_client(url, key)

def get_hash(database, table, hash):
    try:
        return database.table(table).select("*").eq("hash", hash).execute()
    except Exception as e:
        return ([None, None], None)
    

def upsert_data(database, table, data):
    try:
        return database.table(table).upsert(data).execute()
    except Exception as e:
        return {}