2022-11-08 20:43:34 +10:00
|
|
|
from sqlalchemy import create_engine, MetaData, Table, Integer, String, \
|
|
|
|
Column, DateTime, ForeignKey, Numeric
|
|
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
|
|
|
|
engine = create_engine('sqlite:///dick3.db')
|
|
|
|
Session = sessionmaker(bind=engine)
|
|
|
|
session = Session()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class user(Base):
|
|
|
|
__tablename__ = 'users'
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
user_id = Column(Integer)
|
|
|
|
user_fullname = Column(String)
|
|
|
|
|
|
|
|
|
2022-11-08 22:06:11 +10:00
|
|
|
|
|
|
|
c2 = user(user_id = 1234, user_fullname = 'sfsfsfsfs')
|
|
|
|
|
|
|
|
session.add(c2)
|
|
|
|
session.commit()
|
2022-11-08 20:43:34 +10:00
|
|
|
|
2022-11-08 21:51:35 +10:00
|
|
|
#Base.metadata.create_all(engine)
|
2022-11-08 20:43:34 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|