FastAPI dependency to get the synchronous Supabase client. This allows for proper dependency injection and easier testing. Returns: Supabase: The synchronous Supabase client instance
()
| 16 | |
| 17 | |
| 18 | def get_supabase(): |
| 19 | """ |
| 20 | FastAPI dependency to get the synchronous Supabase client. |
| 21 | This allows for proper dependency injection and easier testing. |
| 22 | |
| 23 | Returns: |
| 24 | Supabase: The synchronous Supabase client instance |
| 25 | """ |
| 26 | |
| 27 | from agentops.api.environment import SUPABASE_KEY, SUPABASE_URL |
| 28 | |
| 29 | global supabase |
| 30 | if supabase is None: |
| 31 | with _supabase_lock: |
| 32 | # Check again inside the lock to prevent race conditions |
| 33 | if supabase is None: |
| 34 | supabase = Supabase(SUPABASE_URL, SUPABASE_KEY) |
| 35 | return supabase |
| 36 | |
| 37 | |
| 38 | async def get_async_supabase(): |
no test coverage detected
searching dependent graphs…