Здравствуйте.
Столкнулся с проблемой при работе с sqlalchemy
companyUrl = 'http://site.com' + item.find('div', {"class": "info"}).find('a')['href'])
company = Company.query.filter_by(url=companyUrl).first()
if company == None:
company = Company()
company.url = companyUrl
db.session.merge(company)
db.session.commit()
выдает ошибку
sqlalchemy.exc.DataError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (_mysql_exceptions.DataError) (1406, "Data too long for column 'url' at row 1") [SQL: 'INSERT INTO company (company_name, url, logo, icon, cover_photo, description, about_text, employees) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)'] [parameters: ('Globus-ltd', 'http://brainstorage.me/companies/Gulnazakhmetshinaglobus-ltdcom', None, None, None, None, None, None)]
* Detected change in 'E:\\Users\\gadfil\\PycharmProjects\\firstapp\\app\\parsers.py', reloading
* Restarting with stat
* Detected change in 'E:\\Users\\gadfil\\PycharmProjects\\firstapp\\app\\parsers.py', reloading
* Restarting with stat
при этом без добавления строки '
site.com' все работает, длина получившейся строки не больше 70, длина в столбце базы данных 150
companyUrl = item.find('div', {"class": "info"}).find('a')['href'])
company = Company.query.filter_by(url=companyUrl).first()
if company == None:
company = Company()
company.url = companyUrl
db.session.merge(company)
db.session.commit()