python-sqlite-orm icon indicating copy to clipboard operation
python-sqlite-orm copied to clipboard

why I recieved this error?

Open NSH531 opened this issue 5 years ago • 1 comments

Traceback (most recent call last): File "files.py", line 25, in mydata = MyData(query=query,filename=a,lineNum=ln,lineText=part).save() File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\o rm.py", line 158, in save return self.class.manager(type_check=type_check).save(self) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\o rm.py", line 172, in manager return Manager(db if db else cls.db, cls, type_check) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\o rm.py", line 83, in init self.db.executescript(render_create_table_stmt(self.model)) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\o rm.py", line 35, in render_create_table_stmt column_definitions = ', '.join(render_column_definitions(model)) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\o rm.py", line 29, in render_column_definitions return ['%s %s' % (k, DATA_TYPES[v]) for k, v in attrs(model).items()] File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\o rm.py", line 29, in return ['%s %s' % (k, DATA_TYPES[v]) for k, v in attrs(model).items()] KeyError: <orm.Database object at 0x0000000002542C40>

NSH531 avatar Nov 11 '20 10:11 NSH531

Hi, Just in case anyone has this problem ever again : table names much match the name of the model classes, and it is case-sensitive.

Vanane avatar Aug 10 '22 17:08 Vanane