Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/347.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 无法为具有一个主键的映射表组装任何主键列_Python_Database_User Interface_Tkinter_Sqlalchemy - Fatal编程技术网

Python 无法为具有一个主键的映射表组装任何主键列

Python 无法为具有一个主键的映射表组装任何主键列,python,database,user-interface,tkinter,sqlalchemy,Python,Database,User Interface,Tkinter,Sqlalchemy,我正在开发一个tkinter gui应用程序,并使用sqlite作为存储模式,在创建一个面向此的引擎之后尝试创建一个表 我的代码如下所示 Base = declarative_base() Session = sessionmaker(bind=engine) session = Session() class Records(Base): __tablename__ = "Records" track_id = Column(Integer, prim

我正在开发一个tkinter gui应用程序,并使用sqlite作为存储模式,在创建一个面向此的引擎之后尝试创建一个表

我的代码如下所示

Base = declarative_base()
Session = sessionmaker(bind=engine)
session = Session()


class Records(Base):
    __tablename__ = "Records"
    track_id = Column(Integer, primary_key=True),
    weight = Column(String),
    pur_price = Column(String),
    pur_date = Column(String),
    dist_name = Column(String),
    cat = Column(String),
    polish = Column(String),
    making = Column(String),
    karat = Column(String)
软件包版本

Babel      2.9.0
pip        20.2.4
pytz       2020.4
setuptools 50.3.2
SQLAlchemy 1.3.11
tkcalendar 1.6.1

您是否可以稍后在SQLAlchemy中创建表并添加主键?SQLAlchemy不会在创建表后自动更新表结构并进行更改。没有表尚未创建我刚刚添加了第一个表,出现此错误。您是否可以创建表并在SQLAlchemy中添加主键?SQLAlchemy不会在创建表后自动更新表结构并进行更改。没有表尚未创建我刚刚添加了第一个表,出现此错误