Can Coda and Mysql database sync together

Is there a way that we can integrate coda table with a database? where the database is the single source of truth of all the data? And the coda is more of the interface of the database? Where things in coda changed, the data in the database would be changed? When the data in the database change, it would also reflect in coda as well?

1 Like

I think you could accomplish this by building a Coda Pack with a sync table:

Sync tables take data from an outside source and make it available as a special type of table in Coda. You can then use custom actions along with that table to achieve a form of two-way sync:

Coda Packs can currently only make HTTP requests however, so you’d need to expose an HTTP interface to your database. Take a look through the docs, and feel free to book some time during office hours if you want to chat further.

1 Like

@Bob_Zhang did you ever successfully set up a two way sync between coda and your db?

I’m considering setting something similar up and would appreciate any tips you have.

Hi Chris,

I have not, I am waiting on that as well.

Bob

@Eric_Koleda Have you seen other customers implement a Coda/DB sync?

Any examples I could follow use as a reference would be great.

No, unfortunately I haven’t come across this yet, nor for I have any examples I can share. I can think of a few different approaches:

  • Create a “proxy” API server that takes a SQL query from the request, runs it against the DB, and returns the result.
  • Build a REST or GraphQL API on top of the database, and make requests to it.

Now that I think of it, @Vinny_Green1 has posted about integrating a Pack with Directus, which adds an API layer on top of a database. I haven’t tried it myself, but perhaps he has some tips to share.

@Eric_Koleda No problem. Im probably going to try the second option and build an API on our database to interact with Coda.

Nice call out with Directus…seems like a good fit for what I need. I’ll definitely check it out.

Let me know if you need help. Directus is a great option and I have developed coda pack code for Directus Cloud and individual directus instances. I have a method of syncing any tables in Coda to directus and then pull those tables into Coda via API.

@Vinny_Green1 will do. We have some of our data in Power BI’s Datamart which has a SQL endpoint so it might be possible to use a proxy API server as @Eric_Koleda mentioned. The benefit to the Datamart is that we’ve defined our business logic and applied them to our tables so there’ll be less rework.

However, I don’t believe we have access to the DB to install software like Directus. I’ll look into it more though. Worst case we install Directus on top of our SQL DB and forgo using the Datamart.

@Chris_Williams i came here searching for the same functionality. Understanding we need a pass thru api layer, I have two tools to suggest, Postgrest and Hasura.

In both cases you run a binary configured against your db & get an autogenerated api server with GET/POST/PATCH/DELETE endpoints corresponding to your tables. Both projects are mature & actively maintained with lots of sec & performance considerations. Pretty cool stuff.

@Eric_Koleda have to say this seems like a miss to me–while Coda differentiates itself as being data first, I’m looking for something I can use as an operating interface on top of my db. Offered kindly :slight_smile:

@bobsled ; thanks for the references! I am in complete agreement with you with regards to coda being able to provide some better “data-takeout” interface… I am using Coda to pipeline mission critical data from my employees into tables. Obviously there’s a need to save the data in some DB or some other synced place at the very least…so many things could go wrong:

  1. Accidentally delete some rows
  2. Accidental / Purposeful change to column formulas causes data loss
  3. Document crashes
  4. Possibility of having to interact with some dataset that’s simply not possible to host on coda…
1 Like