Hi Miguel, I followed your flask-mega-tutorial to develop an internal employee directory app. But I'm having an issue with SQLIte and MySQL when it comes to storing output from a WYSIWYG editor. While developing I used SQLite like you recommended in your tutorial. I used the Text() type to store the HTML data from the editor, which worked fine for me. But once I deployed to our server and over to MySQL I started getting "Data too long for column" errors for any output longer than a few sentences.
Do you know if there are any significant differences between SQLite and MySQL that would cause this issue?
Thanks!
#3Miguel Grinberg said
2019-11-25T22:58:29Z
@James: SQLite is not strict with lengths, but MySQL is. Are you sure this is for a column of type Text? My guess is that this problem is for a String or similar column where you either didn't specify a size or the size is small compared to the content you are writing to the column.
#4James said
2019-11-26T20:56:01Z
@Miguel: No It's definitely set to Text
about_me = db.Column(db.Text)
It is possible that I need to set a length for Text as well?
#5James said
2019-11-26T21:37:27Z
@Miguel: So an quick update. It looks like I'm running up against some 140 character limit in my strings for Text. If I go passed that I get the "Data is too long" error.
#6Miguel Grinberg said
2019-11-27T14:14:26Z
@James: are you sure the model agrees with what's in the database? Please check the database schema using a MySQL admin tool. I think you must have had the 140 character limit in the past, or in a migration file. If you changed from 140 to unlimited that needs a new database migration.
#7James said
2019-12-12T21:22:33Z
@Miguel: Just an update on this, I did as you suggested and noticed that the column was set as VARCHAR(140). I was able to switch the column over to LONGTEXT and this cleared up my issue. Thanks for the help!
My Kickstarter project was a big success! Thank you to everyone who contributed to it!
If you would you like to support my work on this tutorial and on this blog and as a reward have access to the complete tutorial nicely structured as a book and/or a set of videos, you can now order it from my Courses site or from Amazon.
About Miguel
Welcome to my blog!
I'm a software engineer, photographer and filmmaker, currently living in Drogheda, Ireland.
#1 Tiago said 2019-10-16T19:56:17Z
#2 James said 2019-11-25T21:16:14Z
#3 Miguel Grinberg said 2019-11-25T22:58:29Z
#4 James said 2019-11-26T20:56:01Z
#5 James said 2019-11-26T21:37:27Z
#6 Miguel Grinberg said 2019-11-27T14:14:26Z
#7 James said 2019-12-12T21:22:33Z