0

I have a pickle file crated using old versions of python 2 and SQLAlchemy (1.0.14), which is a mysql database template.

To read the file I used this script:


import pickle
import os
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import create_session
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.engine.reflection import Inspector

template_path = os.path.join( os. getcwd(), 'mysqldb_file')
with open(template_path, "rb") as file:
    src_tables = pickle.load(file)

when I run the script, I got this error:

src_tables = pickle.load(file)

File "C:\Users\MEGAPC\anaconda3\lib\site-packages\sqlalchemy\sql\base.py", line 1328, in setstate object.setattr(self, "_index", state["_index"])

KeyError: '_index'

I uploaded the template file in google drive if someone want to test it.

enter link description here

I don't have any experience with databases and sqlalchemy. Could someone help me to resolve this problem? Thank you so much.

python_user
  • 5,375
  • 2
  • 13
  • 32

0 Answers0