Working database and then not

Hi guys I’m new to coding and have bene using the agent, I’ve rebuilt the same app 4 times and each time I get user registration working, move on to other features and then the database endpoints crash. I then end up spending usage dollars on going over and over to fix the database/make a new one etc. The whole thing is frustrating and is making me crazy. Anyone had this? Thoughts would be appreciated.

try giving it a prompt like: “database schema alignment issues, review form structures, missing database columns and remove duplicate table definitions and duplicate code” - if it happens soon after adding more features try just “add missing database columns and update database”

Hello!

This was one of the first issues I ran into. I would create an initial suite of features that relied on information pulled from the database to be displayed in UI. The initial setup would work great, and I would then start to add new features that would require the agent to change and edit the schema of a table that was being called upon to provide the information displayed in the UI. As soon as that edit was made, though, any UI features that relied on that table would suddenly not work or disappear entirely, leading to countless death loops of trying to fix the issue or rebuild the thing I was working on entirely. After checking the database to make sure the table hadn’t been dropped completely (which will occasionally happen - make sure to watch the progress input for any Drop table SQL commands and roll back your database if you see that) and checking the returned information from the api get call (look at your console view to see this) I realized that any data that existed in the table before naturally was returning a NaN type error (if the type format was an integer - was set to only contain numbers) or was null (if it was set to contain a string ie words) for that new column.

Python and api’s are incredibly sensitive sometimes and if a null or NaN type is returned from the get request, even for just one of the values specified in the GET request, your UI will simply ignore it - leading to features that were working to either break or disappear entirely. Solution - when ever you make a request to your agent that results in a table being appended to include a new column to support a additional feature make sure to:

  1. Check your database to see if it inserted a placeholder value in that column for historical data

  2. If it has not inserted a placeholder value, ask your agent to do so by referencing the specific table name, column name, and provide the place holder value you would like to have inserted.

And voila, functionality is restored! If you do not feel comfortable working in the backend of the database to do this type of investigating I would suggest creating a database interface page with a csv reader if you’re uploading initial data/schemas that also allows you to filter between the different tables in the database and edit them. Heck, you could even ask it to display the UI connections to each table via a list and provide the ability to manually run and view the return of each API get or post request associated with each connection, so you don’t have to search through all of the console commands! Hope this helps!