Crazy-Marvin / sneak.page

Get an overview of sneak previews in your local cinema(s)
https://sneak.page/
Apache License 2.0
24 stars 6 forks source link

Sync Data From TMDB Into Supabase #14

Open CrazyMarvin opened 2 years ago

CrazyMarvin commented 2 years ago

The data from the The Movie Database (TMDB) API shall be saved in Supabase so that we don't have to query TMDB often.

TMDB sneak.page
original_title title
runtime runtime
overview synopsis
tmdb_id tmdb_id
imdb_id imdb_id
Poster? Poster?

Is there a solution within Supabase which could be used for this like Edge Functions or a direct command in the database? 🤔

Regarding the poster, I am not sure if it should go directly into the database or into an object storage. I suppose an object storage might be better though.

The function should provide a route that the consumer will request the movie info from, when this happens it will go first to see if it is saved in Supabase. If yes, will serve it from Supabase, if not will fetch it from TMDB remote API and then store it and finally return it as a response.

CrazyMarvin commented 1 year ago

Supabase support recommends to use Supabse Edge Functions in combination with Bulk Loading.

JustinJames-UK commented 1 year ago

PostgreSQL holds objects - in a table form with its own datatype. I recommend using SupaBase to hold object. To be more clear everything in PostgreSql is an object....!

JustinJames-UK commented 1 year ago

...as for direct command in the database...please explain. in PostgreSQL we write our functions by hand or I use my libary data. Internal functions which are written in SQL and PL/pgsql programming. The pl/pgsql is for advanced functions and triggers. They work internally on the database server and asks as a automation service directly on the database server. In web apps we can create these same functions in various langauges. However, no function in any language outside of the database server would be as fast as an internal database server programming. The reason why developers use functions outside of the database server is for portability.

JustinJames-UK commented 1 year ago

I don't have time today to look up supabase edge, so please explain here what it is....

CrazyMarvin commented 1 year ago

Thanks for your offer to help, @JustinJames-UK! 👍

I did not use Supabase Edge Functions yet. But basically you can run TypeScript functions with them.

Don't worry about time. It is not urgent.

JustinJames-UK commented 1 year ago

I have checked out Supabase cli, I can install it on my local computer and connect remotley, I will be able to programme the functions easy in pl/pgsql. I will automate the database with normilization which will help with queries in the future. I have also noticed your schema path is public which is ok for now but as I build your database I would want to set a schema path. I am off now until Monday where I would be looking to hear from your about tables. Have a great weekend, Justin