尝试使用 Django 将数据插入到我的数据库中的表中。这是我要插入的表的模型:
class RunableFilters(models.Model):
equipment_id = models.BigIntegerField(null=True, blank=True)
filter_file_name = models.CharField(max_length=255, blank=True)
last_updated = models.CharField(max_length=255, blank=True)
class Meta:
db_table = 'runable_filters'
我得到的错误:
>>> from books.models import RunableFilters
>>> p1 = RunableFilters(equipment_id = '123456778', filter_file_name = "test_file_name", last_updated = "2013-16-8")
>>> p1.save()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 546, in save
force_update=force_update, update_fields=update_fields)
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 650, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "C:\Python27\lib\site-packages\django\db\models\manager.py", line 215, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line 1675, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 937, in execute_sql
cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 41, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\oracle\base.py", line 717, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "C:\Python27\lib\site-packages\django\db\backends\oracle\base.py", line 710, in execute
return self.cursor.execute(query, self._param_generator(params))
DatabaseError: ORA-00904: "RUNABLE_FILTERS"."ID": invalid identifier
那是我数据库中的表