Retool Form not syncing properly with database

  • Goal:
    When I click "sync with database" on Retool Forms, it says

However, after I add the "other_info" item, it goes ahead and deletes the field "other_info" in my untitled5 table. So, I have to manually add that column back in, and not publish the form. Otherwise, it will give me the error "other_info" doesn't exist in untitled5.

Furthermore, I'm unable to rename the untitled5 table to something like "raw_form_responses". Every time I do so, Retool says "Failed to publish." Is there a reason for this?

Hi @Jeffrey_Yu,

Can you share a few screenshots or better yet, export your json file. It will be easier to see what is going on.

Ah yes, good idea! Unfortunately, it's still not possible to export a Retool Form as JSON:

However, I've recorded a short Zoom clip to demonstrate the mismatch!

Thanks for the video. It helps!

First, to rename your table you should be able to do it easily in the Reetool Database.
chrome_GhqspLDNzg

When you do this, you will temporarily lose the connection to your form. You just need to refresh the page on the form and reconnect to the table with your new name.

chrome_q6lXYT22gn

I would then add the id to the form and set it to hidden.

Regarding "other_info", can you make sure you have it in your table. Then, please delete the "other_info" section in your form:
chrome_nE1CkIUNL8

Then, sync from database again and let me know what happens. I am guessing this will fix your issue. :sweat_smile:

2 Likes

Thank you so much for helping me debug Shawn! I appreciate it.

I tried all of your steps, and unfortunately, it still didn't work. I'd tried changing the database link before, but then it kept failing updating. I'm not sure why, but I think it's because Retool Forms only work with predefined tables.

Here's a zoom clip where I followed each of your steps: Clips

Hi @Jeffrey_Yu,
Happy to help. Hopefully we can find a solution here.

Correction when I suggested adding the id. I would add it but the same way you add other_info, by syncing, then making it invisible.

Otherwise, after you change the table name, you have the option to generate the form. If you click on that it should add all the fields necessary but you would have to start from scratch.

Update: I decided to just omit the problematic other_info field, and this appeared to get it to work. It was the fastest and simplest solution. Thanks for all the help though Shawn! Maybe if someone else encounters this bug, this will be helpful to them.

2 Likes

You are welcome @Jeffrey_Yu. Good luck!

1 Like

Thank you both for sharing troubleshooting steps. I don't see these issues listed as known bugs, but I'll try to reproduce them.

The other thing I'd be curious about is whether this happens in a brand new form. In any case, glad you have a workaround (even though it's not ideal!).

Quick follow up - I haven't been able to reproduce this exact behavior, but I was definitely able to reproduce some unexpected behavior with sync from database. I'll flag it to our team for a fix.

In my testing so far, this is what I'm seeing:

  1. Sync new column from database
  2. See column is added to form
  3. Reload the page
  4. Note that Sync from database allows me to add the column again even though it's already in the form (can continue to add endless "duplicate" columns)
1 Like

Thanks @Tess! It would be fantastic if we could export to json or save in another form. It would allow us to help troubleshoot.

I also noticed, and I believe you see this in @Jeffrey_Yu 's second video, when you rename a table and reconnect it, it doesn't seem to recognize the existing fields and want to add new ones when you try to Sync from database.

Update: I ended up just rebuilding the form from scratch by generating from the database (great suggestion @Shawn_Optipath). It took me about 45 minutes, but that fixed all the issues. Hopefully retool can fix the syncing issues in the future!