Role | API/Tool |
---|---|
supabase_admin | Used by Supabase to configure projects and for monitoring |
authenticator | PostgREST (Database API) |
supabase_auth_admin | Auth |
supabase_storage_admin | Storage |
supabase_realtime_admin | Realtime |
supabase_replication_admin | Synchronizes Read Replicas |
postgres | Supabase Dashboard and External Tools (e.g., Prisma, SQLAlchemy, PSQL...) |
Custom roles defined by user | External Tools (e.g., Prisma, SQLAlchemy, PSQL...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
cast(postgres_logs.timestamp as datetime) as timestamp, | |
parsed.error_severity, | |
parsed.user_name, | |
parsed.query, | |
parsed.sql_state_code, | |
event_message | |
from postgres_logs | |
cross join unnest(metadata) as metadata | |
cross join unnest(metadata.parsed) as parsed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
cast(timestamp as datetime) as timestamp, | |
event_message, | |
status_code | |
from edge_logs | |
cross join unnest(metadata) as metadata | |
cross join unnest(metadata.request) as request | |
cross join unnest(metadata.response) as response | |
where | |
-- only look for requests through the database API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION example (num INT DEFAULT 10) RETURNS TEXT AS $$ | |
DECLARE | |
var1 INT := 20; | |
var2 TEXT; | |
BEGIN | |
-- Logging start of function | |
RAISE LOG 'logging start of call to function example: (%)', (SELECT NOW()); | |
-- Logging a variable from a SELECT query | |
SELECT col_1 FROM some_table INTO var1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ADD YOUR PRIVATE KEY | |
select vault.create_secret('<PRIVATE KEY>', 'clerk_private_key'); | |
-- after executing the below code, you can query your user data from Clerk with the following query: | |
-- SELECT * FROM clerk_users; | |
-- Requires HTTP extension to function | |
create extension if not exists http with schema extensions; | |
CREATE OR REPLACE FUNCTION clerk_get_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Issue relates back to this GitHub Ticket for PG_NET: | |
-- https://github.com/supabase/pg_net/issues/86 | |
-- Summary: | |
-- When PG_NET is called excessively, calls are not made to endpoints. | |
-- The net._http_response table will record responses as "timed_out" | |
-- I recommend creating a new project in Supabase to test the issue. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
CONTEXT: | |
This is an annotated version of Dolthub's tutorial on | |
Foreign Data Wrappers. | |
SOURCE: https://www.dolthub.com/blog/2022-01-26-creating-a-postgres-foreign-data-wrapper/ | |
This code matches this schema: | |
CREATE EXTENSION tutorial_fdw; | |
CREATE SERVER tutorial_server FOREIGN DATA WRAPPER tutorial_fdw; | |
CREATE FOREIGN TABLE sequential_ints ( val int ) SERVER tutorial_server OPTIONS ( start '0', end '64' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION example (num INT DEFAULT 10) RETURNS TEXT AS $$ | |
DECLARE | |
var1 INT := 20; | |
var2 TEXT; | |
BEGIN | |
-- Logging a variable from a SELECT query | |
SELECT col_1 FROM some_table INTO var1; | |
RAISE LOG 'logging a variable (%)', var1; | |
-- It is also possible to avoid using variables, by returning the values of your query to the log | |
RAISE LOG 'logging a query with a single return value(%)', (SELECT some_message_value FROM some_table LIMIT 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Header--> | |
<h1> Change Widgets Color </h1> | |
<!-- Short app explanation --> | |
<p> | |
Will change the color of all objects with the key word in their title | |
</p> | |
<!--Asks user for a hex color value--> | |
<label for = 'hex-input'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Tells Figma to display your custom UI | |
figma.showUI(__html__); | |
//Resizes your plugin UI in pixels | |
figma.ui.resize(400, 400) | |
/* | |
This is our custom function | |
When a user submits an input from our plugin UI, | |
this will take care of it |
NewerOlder