Skip to content

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

Open

Description

@Nathan-ZR

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='创建的时间')

Activity

  1. six1203 commented on Jul 16, 2023

    @six1203

    me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions