Я пытаюсь написать подкласс из этого класса:
class InsertCreateAlter(object):
def __init__(self, url=None, engine=None, connection=None, session=None,
**kwargs):
if connection is not None:
self.engine = connection
elif engine is not None:
self.engine = engine
elif session is not None:
self.engine = session
else:
self.engine = sqlalchemy.create_engine(url, **kwargs)
Это была моя попытка:
class InsertCreateAlterEAV(InsertCreateAlter):
def __init__(self, url=None, engine=None, connection=None, session=None,
**kwargs):
InsertCreateAlter.__init__(self, url=None, engine=None, connection=None, session=None,
**kwargs)
if connection is not None:
self.engine = connection
elif engine is not None:
self.engine = engine
elif session is not None:
self.engine = session
else:
self.engine = sqlalchemy.create_engine(url, **kwargs)
Когда я вызываю функцию как:
InsertCreateAlterEAV(session=session)
Я получил ошибку:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-ee54fec26f76>", line 2, in <module>
InsertCreateAlterEAV(session=session)
File "/Users/asportelli/Documents/gitRepos/etl/etl/eav/InsertCreateAlterEAV.py", line 18, in __init__
**kwargs)
File "/Users/asportelli/Documents/gitRepos/etl/etl/insert/InsertCreateAlter.py", line 27, in __init__
self.engine = sqlalchemy.create_engine(url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/__init__.py", line 425, in create_engine
return strategy.create(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 52, in create
plugins = u._instantiate_plugins(kwargs)
AttributeError: 'NoneType' object has no attribute '_instantiate_plugins'