Zu Hauptinhalten überspringen

Cookie Einstellungen

Wir verwenden Cookies, um die grundlegenden Funktionalitäten der Website zu gewährleisten und Ihr Online-Erlebnis zu verbessern. Sie können jederzeit die Verwendung der Cookies konfigurieren und akzeptieren oder Ihre Zustimmungsoptionen ändern.

Notwendige

Präferenzen

Analysen und Statistiken

Marketing

Week 4 : Mautic Marketplace: Interacting with Supabase for main implementation

Avatar: Kgitman Kgitman

Welcome to week 4

In my last blog post of Week 3, I mentioned that I would be able to obtain all the plugin and theme data successfully. I intended to test this script by monitoring the data in the database.

The code has been modified and now I have a code that retrieves all plugins and themes and inserts the data into the database. I made an effort to run that,

With the
deno run --allow-env --allow-read --allow-net supabase/functions/fetch_packag/index.ts

but the issue occurred!

 I faced a major challenge this week that my data was not inserting into the database. I can see the requests on the dashboard that I'm making to supabase by running the script, but I'm unable to store the data into the database! 

means the connection with the database is ok, but there is a problem in inserting the data to the database.

I discussed this with mentors and they suggested me to first start with simple insertion and then implement the loop and other things one by one. 

I followed the approach and I also found some bugs in my code that led to undesired output!

So, I also changed the code and the structure of data which I was preparing for the Packagist API. because somehow, I found that the data structure was not syncing with the Packagist API response!

After this sort of change I was finally able to insert only one package data and I'm able to store that one package. Then I tried all the packages and guess what, I successfully stored all the package data into the supabase database!

but here is the twist, I again run the script and all the data is inserted again so that's not what we want, again with some discussion with mentors they suggested me the UPSERT!

UPSERT is perform UPDATE and INSERT. It updates the value if it already exists and it inserts the value if not already there!

Next Week:

Next week I'm using UPSERT and will note the results.

Anything you want to ask related to my project, please do comment below! 

Thanks for your valuable time!

Unangemessenen Inhalt melden

Wieso ist dieser Inhalt problematisch / unangemessen?

Begründung:
Kommentare werden geladen ...

Sie müssen sich mit einem bestehendem Konto anmelden oder ein neues Konto registrieren, um Ihren Kommentar hinzufügen.

Bestätigen

Bitte melden Sie sich an

Sie können mit einem externen Konto darauf zugreifen

Teilen