【发布时间】:2016-10-25 09:48:38
【问题描述】:
我正在尝试使用 Python 更新一个空的 mySQL 数据库。
这是我收到的错误:
pymysql.err.InternalError: (1416, 'Cannot get geometry object from data you sent to the GEOMETRY field')
这是有问题的代码:
try:
with connection.cursor() as cursor:
# Create a new record
sql = "INSERT INTO `projects` (`name`, `country`, `activation_date`, `active`) VALUES (%s, %s, %s, %s)"
cursor.execute(sql, ('Nate', 'USA', '2016-06-23 09:11:32', '1'))
connection.commit()
finally:
connection.close()
这是表在数据库中的样子(它是空的):
【问题讨论】:
-
能否包含表的定义(包括索引和触发器)?从您的帖子中看不出是什么引发了错误。
-
是的,我认为您以错误的方式使用数据类型
LineString,并且意味着使用 varchar 或 text 类型。 A LineString consists of Points 用于空间数据,而不是文本。