Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The data table name is inconsistent with the generated class name #46

Open
Nathan-ZR opened this issue Dec 20, 2021 · 1 comment
Open

Comments

@Nathan-ZR
Copy link

If the name of the data table has "s" at the end, the "s" will be removed from the name of the class in the generated py file. I don't know if it is a bug in the flask-sqlacodegen package or there is a problem with the command line I use.

The command line I used:
flask-sqlacodegen mysql+pymysql://user:password@ip:port/python_codegen?charset=utf8 --tables students --outfile studentsModel.py --flask

The generated code is:

# coding: utf-8
from flask_sqlalchemy import SQLAlchemy


db = SQLAlchemy()



class Student(db.Model):
    __tablename__ = 'students'

    AutoID = db.Column(db.BigInteger, primary_key=True, info='主键 自动递增')
    StudentID = db.Column(db.BigInteger, info='学生ID 业务主键')
    StudentName = db.Column(db.String(50), info='学生姓名')
    ClassID = db.Column(db.BigInteger, index=True, info='班级ID 外键')
    HeadPic = db.Column(db.String(200), info='头像URL')
    IsDelete = db.Column(db.Integer, server_default=db.FetchedValue(), info='状态 0-未删除(正常);1- 删除 (停用)')
    CreateTime = db.Column(db.DateTime, server_default=db.FetchedValue(), info='创建的时间')

@six1203
Copy link

six1203 commented Jul 16, 2023

me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants