1

I built a scraper and it doesn't seem to like my description length. I altered the column to varchar(500) but no dice. I think I need to convert to text, but I am not sure how to. Does that make sense in my case? Thanks!

Error-

Mysql2::Error: Data too long for column 'description' at row 1: INSERT INTO sammiches (country, created_at, description, image, name, updated_at) VALUES ('Italy', '2013-05-03 01:10:08', 'In Italy, panino is the word for a sandwich made from bread other than sliced bread, in which case Italians call it a tramezzino or porco. Examples of bread types used are ciabatta, rosetta and baguette. The bread is cut horizontally and filled with deli ingredients such as salami, ham, cheese, mortadella, or other food, and sometimes served warm after having been pressed by a warming grill. In the United States, United Kingdom and Canada, the term panini has been adopted to refer to a pressed and toasted sandwich; there is widespread availability and use of sandwich presses, often known as \"panini presses\" or \"toasted sandwich makers.\"', '/wiki/File:Italian_Sandwich.jpeg', 'Panini', '2013-05-03 01:10:08') (ActiveRecord::StatementInvalid)

Simon Martin
  • 4,203
  • 7
  • 56
  • 93
DynastySS
  • 395
  • 3
  • 5
  • 18

3 Answers3

4

Your length is about 650 characters now. Try to increase more.

Alex
  • 11,451
  • 6
  • 37
  • 52
2

the type VARCHAR() just can go up to 255 characters. Try TEXT instead.

http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

medina
  • 8,051
  • 4
  • 25
  • 24
1

-- if a table restrict you to insert data becasue the length is smaller and -- you realy want to get rid of the restriction -- do this

show global variables like '%sql%mode'; set global sql_mode='NO_ENGINE_SUBSTITUTION'; -- also set it here -- /etc/my.cnf -- http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html

pavelcc
  • 131
  • 1
  • 2
  • 9