Use this to lock down the schema if you have JSON or JSONB columns

  Рет қаралды 3,674

Supabase

Supabase

Күн бұрын

pg_jsonschema lets you validate schema for your JSON and JSONB columns. In this video, Tyler Shukert walks you through how to restrict the schema of your JSON and JSONB columns to ensure the integrity of the database is kept.
Learn more ways to lock down your schema: json-schema.org/learn/getting...
JSON and JSONB columns allow you to be flexible with what type of data you want to store, but you might still want to restrict the schema of the JSON to some degree. pg_jsonschema is a light-weight Postgres extension that allows you to define a schema for your JSON and JSONB columns to ensure database integrity.
00:00 Intro
00:34 Go over the table
01:15 How to use pg_jsonschema
04:35 Apply constraints on table
06:02 Outro
💻 Videos to watch next:
▶ How to support unstructured data in Postgres with JSON columns: • How to store and query...
▶ FASTEST way to host a Postgres database (2024):
• FASTEST way to host a ...
▶ Create PostgreSQL Functions with Supabase: • Create PostgreSQL Func...
👇 Learn more about Supabase 👇
🕸 Website: supabase.com/
🏁 Get started: app.supabase.com/
📄 Docs: supabase.com/docs
🔔 Subscribe for more tutorials and feature updates from Supabase: / @supabase
📱 Connect with Us:
🐙 Github: www.github.com/supabase
💬 Discord: www.discord.supabase.com/
🐦 Twitter: / supabase
▶ Instagram (follow for memes): / supabasecom
ABOUT SUPABASE:
Supabase is the open source Firebase alternative. Supabase provides a full Postgres database for every project with pgvector, backups, realtime, and more. Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs.
Build in a weekend, scale to millions.
#Supabase #AppDevelopment #RealtimeApps #DeveloperTools

Пікірлер: 26
@Supabase
@Supabase Ай бұрын
Thanks for tuning in! JSON Schema has an amazing docs that walk you through various examples of how you can use it. json-schema.org/learn/getting-started-step-by-step
@skrobonja32
@skrobonja32 Ай бұрын
Robert Downey Jr. always has killer tips! 💪Great tutorial!
@rembautimes8808
@rembautimes8808 11 күн бұрын
Wow - thanks for sharing. Was looking for this video and as I have used RXDB before I can see how it works. Thanks a lot.
@EmielvanGoor
@EmielvanGoor Ай бұрын
Exactly what I needed, keep the tips coming! Loving Supabase (and PostgreSQL) everyday more and more! Thanks!
@dshukertjr
@dshukertjr Ай бұрын
Thanks for the positive comment! More Postgres content coming on this channel!
@luisandrade1291
@luisandrade1291 Ай бұрын
Please tell me it has support for your typescript types codegen.
@tylershukert3621
@tylershukert3621 Ай бұрын
At the moment no, but that is an awesome suggestion! Will pass the feedback to the team.
@ipranay
@ipranay Ай бұрын
This is super helpful!! Any performance concerns with this extension? (esp if you have a large object schema)
@Supabase
@Supabase Ай бұрын
Generally you shouldn't notice much difference as the extension is very performant, but of course this depends on a lot of factors. You can find some benchmarks here: github.com/supabase/pg_jsonschema?tab=readme-ov-file#benchmark
@andylee5969
@andylee5969 Ай бұрын
Great feature and tutorial :) Anyone think it’d be useful to have a tool that can convert these schemas into zod object schemas?
@mrbjjackson
@mrbjjackson 13 күн бұрын
Have you any tips for having types in our code when processing jsonb data?
@yarapolana
@yarapolana Ай бұрын
Adding types support for the json in the javascript sdk anytime soon?
@dshukertjr
@dshukertjr Ай бұрын
That is an excelent idea. We don't yet have type support for the JSON/ JSONB columns from the pg_jsonschema definition, but will pass the feedback to the JS SDK team.
@williamliu796
@williamliu796 Ай бұрын
What is the use case for this? If your schema needs to be strict, isnt it better to create other tables?
@dshukertjr
@dshukertjr Ай бұрын
There is no single right or wrong in development. If someone chooses to use JSON or JSONB column, they still might want to restrict what data comes in, as by default JSON and JSONB type columns accept a very wide range of schema. Even a plain string or integers are valid JSON types, so this extension helps the developers to ensure those values do not come in.
@takeshikriang
@takeshikriang Ай бұрын
Thank you for sharing this. As a self-taught developer, I have learned a lot with Supabase. Can you create a Postgres tutorial as well?
@Supabase
@Supabase Ай бұрын
Thanks for the kind words! What type of content would you like to see in the Postgres tutorial you wish?
@takeshikriang
@takeshikriang Ай бұрын
@@Supabase For example, something related to multi-tenancy in Postgres. It is tough to find such quality content.
@AymericRabot
@AymericRabot Ай бұрын
How do you handle evolving schemas? migrations?
@Supabase
@Supabase Ай бұрын
You can simply update the check constraint to match the new schema.
@AymericRabot
@AymericRabot Ай бұрын
@@Supabase how do you handle the existing records and upgrade them to the new schema?
@AmitKapadiaUK
@AmitKapadiaUK Ай бұрын
Great! How do you do this via the dashboard gui?
@dshukertjr
@dshukertjr Ай бұрын
Defining JSON schema is currently not supported in the GUI, so you would have to define it from the SQL editor. I will pass the feedback to the frontend team!
@980107105843
@980107105843 Ай бұрын
wow you are still updating this series , cute , good luck , i started this whole project through the login profile videos 😆!
@dshukertjr
@dshukertjr Ай бұрын
Is it the Flutter video you are talking about? Thanks for handing out in our KZbin channel for such a long time!
@980107105843
@980107105843 Ай бұрын
@@dshukertjr Yes its the flutter ones, i think its like 3/6 months ago, idk how much info i can give about this but i am recently creating a private POS , so i went thru ur github pages and look through how u handle errors and handle page transitions, routes etc. Just wanted to let u know was great help :)
Faster queries with index on JSONB columns in Postgres
4:58
Supabase
Рет қаралды 2,4 М.
8 things you should NEVER do in a Database!
22:56
Supabase
Рет қаралды 9 М.
Children deceived dad #comedy
00:19
yuzvikii_family
Рет қаралды 6 МЛН
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 62 МЛН
tRPC, gRPC, GraphQL or REST: when to use what?
10:46
Software Developer Diaries
Рет қаралды 71 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 176 М.
The Free and Open Source Software I Use in 2024 - Part 1
28:31
Awesome Open Source
Рет қаралды 181 М.
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 333 М.
Firebase vs Supabase - I Built The Same App With Both
6:21
Your Average Tech Bro
Рет қаралды 91 М.
Boriss Mejias: Should I use JSON in PostgreSQL? (PGConf.EU 2023)
48:47
PostgreSQL Europe
Рет қаралды 2,1 М.
How to store and query JSON data in Postgres
5:05
Supabase
Рет қаралды 6 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1 МЛН
APPLE совершила РЕВОЛЮЦИЮ!
0:39
ÉЖИ АКСЁНОВ
Рет қаралды 4,3 МЛН