TransWikia.com

How do I fix a 'Argument 'class_' is expected to be of type '', got '' error

Stack Overflow Asked on December 7, 2021

I’m trying to follow the solution in this answer: https://stackoverflow.com/a/44567216/11277108 and have the following code:

Session = sessionmaker()
Base = automap_base()

engine = create_engine('mysql+mysqlconnector://root:root@localhost/')

Base.metadata.reflect(engine, schema='belgarath')
Base.metadata.reflect(engine, schema='oncourt')
Base.prepare()

Base.metadata.bind = engine

session = Session()

query = session.query(Base.classes.matches_atp).join(Base.classes.tours_atp)
print(query)

However, I’m getting two warnings:

SAWarning: Unknown schema content: '  KEY `tournament_id_idx` (`ID_T_G`) /*!80000 INVISIBLE */'
  util.warn("Unknown schema content: %r" % line)

And:

SAWarning: This declarative base already contains a class with the same class name and module name as sqlalchemy.ext.automap.tours_atp, and will be replaced in the 
string-lookup table.

And then this error:

Argument 'class_' is expected to be of type '<class 'type'>', got '<class 'NoneType'>'

It seems clear that the error is occurring because of the second warning but how do I fix this…?


Edit:

I found the offending index, removed it but I’m still getting the second warning and error…

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP