创建表的时候出现warning 为什么
来源:4-6 通过ORM查询数据
慕数据3541479
2018-02-27
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DateTime, Boolean
from sqlalchemy.orm import sessionmaker
engine = create_engine('mysql://zhongming:zhongming@localhost/zhongming?charset=utf8')
Base = declarative_base()
Session = sessionmaker(bind=engine)
class Mynews(Base):
__tablename__ = 'table2'
id = Column(Integer, primary_key=True)
type = Column(String(10), nullable=False)
name = Column(String(20), nullable=False)
author = Column(String(20), nullable=False)
content = Column(String(1000), nullable=False)
view_count = Column(Integer)
public_time = Column(DateTime)
is_valid = Column(Boolean)
# Mynews.metadata.create_all(engine)D:\python36\lib\site-packages\sqlalchemy\engine\default.py:507: Warning: (1366, "Incorrect string value: '\\xD6\\xD0\\xB9\\xFA\\xB1\\xEA...' for column 'VARIABLE_VALUE' at row 497")
cursor.execute(statement, parameters)
写回答
2回答
-
警告还是建表成功了吧
10 -
NavCat
2018-02-27
你看下是不是手动建立数据库时没有设定UTF-8编码
022018-03-25
Python操作三大主流数据库-MySQL+MongoDB+Redis
一次实战同时掌握Python操作MySQL,MongoDB,Redis 三大数据库使用技巧
2024 学习 · 376 问题
相似问题