Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在新类中继承所有sqlalchemy函数?_Python_Inheritance_Sqlalchemy - Fatal编程技术网

Python 如何在新类中继承所有sqlalchemy函数?

Python 如何在新类中继承所有sqlalchemy函数?,python,inheritance,sqlalchemy,Python,Inheritance,Sqlalchemy,我尝试了一些先天性痤疮的组合,但都不起作用。这就是我最后得到的 import sqlalchemy class SentioDB(sqlalchemy): def __init__(self): #Create and engine and get the metadata Base = declarative_base() self.engine = create_engine('mysql://sentio_reader:therea

我尝试了一些先天性痤疮的组合,但都不起作用。这就是我最后得到的

import sqlalchemy
class SentioDB(sqlalchemy):

    def __init__(self):
        #Create and engine and get the metadata
        Base = declarative_base()
        self.engine = create_engine('mysql://sentio_reader:thereader@sentiodb.cloudapp.net/sentio')
        self.engine.echo = True
        self.metadata = MetaData(bind=self.engine)
        self.metadata.reflect(bind=self.engine)
        self.create_all_tables()
        self.session = create_session(bind=self.engine) 
这给

TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)

我肯定错过了一些新手的观点。有什么方法可以做到这一点吗?

sqlalchemy
是一个模块,而不是一个类。您不应该尝试从它继承。

那么是否有其他方法可以从我的自定义类定义中调用它的所有函数?不,Python中不是这样使用函数的。导入它们并在它们所在的位置使用它们。