python: generator model using mysql9.0 or postgreSQL 17.0

server/2024/11/29 10:06:16/

mysql 9.0:

python"># encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : 2024/11/18 22:41
# User      : geovindu
# Product   : PyCharm
# Project   : pyGenerator
# File      : MySqlGenerator/CreateModel.py
# explain   : 学习import os
import re
import sys
import io
import datetime
from common.fileHelper import FileHelper
from common.strHelper import StrHelper
from bll.tableNameAndKey import TableNameAndKeyBll
from bll.tableForegin import TableForeginBll
from bll.tableModel import TableModelBllclass CreateModel(object):""""""def __init__(self):self.__modelpath = os.path.join(os.getcwd() + "/mytest/model/")self.__file = FileHelper()self.__blltablekey = TableNameAndKeyBll()self.__bllTableModel = TableModelBll()self.__database = "MySQL 9.0"self.__os = "windows 10"self.__product = "PyCharm"self.__project = "IctGame"self.__name = "CreateModel"passdef __del__(self):""":return:"""print(f"{self.__name} ERASE MEMORY")def addpackagefile(self):"""生成包配置文件:return:"""now = datetime.datetime.now()#bll = TableNameAndKeyBll()sb = []sbt = f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : model/__init__.py
# explain   : 学习"""sb.append(sbt)for li in self.__blltablekey.selectSql():sbp=f"""
from model.{StrHelper.firstLower(li.TableName)} import {StrHelper.firstUper(li.TableName)}Info
"""sb.append(sbp)if not os.path.exists(self.__modelpath):os.makedirs(self.__modelpath)filepath = self.__modelpath + '__init__.py'content = ''.join(sb)ok = self.__file.createModelFile(filepath, content)def add(self):"""生成实体:return:"""#fileHelper=FileHelper()now = datetime.datetime.now()#bll = TableNameAndKeyBll()for li in self.__blltablekey.selectSql():sb = []sbt=f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : model/{li.TableName}.py
# explain   : 学习class {StrHelper.firstUper(li.TableName)}Info(object):\"""{li.TableDescription}                    \""" 
"""sb.append(sbt)#tbll = TableModelBll()sinhead = f"""def __init__(self):\"""構造\"""               """sb.append((sinhead))for tli in self.__bllTableModel.selectSql(li.TableName):sin=f"""self._{tli.FieldName} = None\"""{tli.FieldDescription}\""""""sb.append(sin)for pli in self.__bllTableModel.selectSql(li.TableName):psb=f"""@propertydef {pli.FieldName}(self):\"""{pli.FieldDescription}\"""return self._{pli.FieldName}@{pli.FieldName}.setterdef {pli.FieldName}(self, {StrHelper.firstLower(pli.FieldName)}):\"""{pli.FieldDescription}:param {pli.FieldName}::return:\"""self._{pli.FieldName} = {StrHelper.firstLower(pli.FieldName)}       """sb.append(psb)if not os.path.exists(self.__modelpath):os.makedirs(self.__modelpath)filepath=self.__modelpath+StrHelper.firstLower(li.TableName)+'.py'content=''.join(sb)ok = self.__file.createModelFile(filepath,content)

postgreSQL 17.0:

python"># encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : 2024/11/18 22:41
# User      : geovindu
# Product   : PyCharm
# Project   : pyGenerator
# File      : postgreSqlGenerator/CreateModel.py
# explain   : 学习import os
import re
import sys
import io
import datetime
from common.fileHelper import FileHelper
from common.strHelper import StrHelper
from bll.tableNameAndKey import TableNameAndKeyBll
from bll.tableForegin import TableForeginBll
from bll.tableModel import TableModelBllclass CreateModel(object):""""""def __init__(self):self.__modelpath = os.path.join(os.getcwd() + "/posttest/model/")self.__file = FileHelper()self.__blltablekey = TableNameAndKeyBll()self.__bllTableModel = TableModelBll()self.__database = "postgreSQL 17.0"self.__os = "windows 10"self.__product = "PyCharm"self.__project = "IctGame"self.__name = "CreateModel"passdef __del__(self):""":return:"""print(f"{self.__name} ERASE MEMORY")def addpackagefile(self):"""生成包配置文件:return:"""now = datetime.datetime.now()#bll = TableNameAndKeyBll()sb = []sbt = f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : model/__init__.py
# explain   : 学习"""sb.append(sbt)for li in self.__blltablekey.selectSql():sbp=f"""
from model.{StrHelper.firstLower(li.TableName)} import {StrHelper.firstUper(li.TableName)}Info
"""sb.append(sbp)if not os.path.exists(self.__modelpath):os.makedirs(self.__modelpath)filepath = self.__modelpath + '__init__.py'content = ''.join(sb)ok = self.__file.createModelFile(filepath, content)def add(self):"""生成实体:return:"""#fileHelper=FileHelper()now = datetime.datetime.now()#bll = TableNameAndKeyBll()for li in self.__blltablekey.selectSql():sb = []sbt=f"""
# encoding: utf-8
# 版权所有 2024 ©涂聚文有限公司
# 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎
# 描述:
# Author    : geovindu,Geovin Du 涂聚文.
# IDE       : PyCharm 2023.1 python 3.11
# OS        : windows 10
# Datetime  : {now.strftime('%Y-%m-%d %H:%M:%S')}
# database  :{self.__database}
# User      : geovindu
# Product   : PyCharm
# Project   : IctGame
# File      : model/{li.TableName}.py
# explain   : 学习class {StrHelper.firstUper(li.TableName)}Info(object):\"""{li.TableDescription}                    \""" 
"""sb.append(sbt)#tbll = TableModelBll()sinhead = f"""def __init__(self):\"""構造\"""               """sb.append((sinhead))for tli in self.__bllTableModel.selectSql(li.TableName):sin=f"""self._{tli.FieldName} = None\"""{tli.FieldDescription}\""""""sb.append(sin)for pli in self.__bllTableModel.selectSql(li.TableName):psb=f"""@propertydef {pli.FieldName}(self):\"""{pli.FieldDescription}\"""return self._{pli.FieldName}@{pli.FieldName}.setterdef {pli.FieldName}(self, {StrHelper.firstLower(pli.FieldName)}):\"""{pli.FieldDescription}:param {pli.FieldName}::return:\"""self._{pli.FieldName} = {StrHelper.firstLower(pli.FieldName)}       """sb.append(psb)if not os.path.exists(self.__modelpath):os.makedirs(self.__modelpath)filepath=self.__modelpath+StrHelper.firstLower(li.TableName)+'.py'content=''.join(sb)ok = self.__file.createModelFile(filepath,content)

mysql:

postgresql:

sql server:


http://www.ppmy.cn/server/145879.html

相关文章

【Ant Design Vue】表单校验 rules 不起作用

先展示修改后可校验的完整 demo<template><div class"rules-container"><a-form-modelref"formRef":model"formState":rules"rules":label-col"labelCol":wrapper-col"wrapperCol"><a-form-…

实验六 用MATLAB设计IIR数字滤波器

例题 例2-1 采用脉冲响应不变法设计一个巴特沃斯数字低通滤波器 要求&#xff1a;ωp0.25π&#xff0c;Rp1dB&#xff1b;ωs0.4π&#xff0c;As15dB&#xff0c;滤波器采样频率Fs2000Hz。 wp0.25*pi; %滤波器的通带截止频率 ws0.4*pi; %滤波器的阻…

【Axure高保真原型】视频列表播放器_横向翻页效果

今天和大家分享视频列表播放器_横向翻页效果的原型模板&#xff0c;我们点击视频列表里的视频&#xff0c;可以在真实的播放该视频&#xff0c;每个视频都可以点击查看&#xff0c;如果视频菜单太多&#xff0c;我们也可以通过点击左右按钮翻页查看。这个视频列表的模板是用中继…

数据库(MySQL黑马)

基础篇 MySQL概述 数据库概述 数据库相关概念 主流的关系型数据库管理系统 MySQL数据库的安装与启动 下载&#xff1a;MySQL :: MySQL Community Downloads 安装步骤 MySQL―8.0.40超详细保姆级安装教程_mysql8.0.40安装教程-CSDN博客文章浏览阅读1k次。_mysql8.0.40安装教…

信息技术与数据安全:打造高效、安全的数据处理系统

信息技术与数据安全&#xff1a;打造高效、安全的数据处理系统 在当今这个信息化高速发展的时代&#xff0c;数据已成为企业运营和决策的核心资源。随着大数据、云计算、人工智能等信息技术的飞速发展&#xff0c;数据处理能力得到了前所未有的提升&#xff0c;但同时也对数据…

itertools模块常用方法

count(start0, step1) import itertools# 创建一个从start开始&#xff0c;以step为步长的无限迭代器 for i in itertools.count(1, 2):if i > 10:breakprint(i) # output: # 1 # 3 # 5 # 7 # 9cycle(iterable) import itertools# 对一个可迭代对象进行无限循环 count 0 …

JS异步进化与Promise

JavaScript 是单线程的&#xff0c;但它并不是无法处理异步操作。相反&#xff0c;JavaScript 的单线程特性和其事件循环机制使得它在处理异步任务方面非常高效 回调函数(Callback Functions) 一开始JS使用回调的形式来处理异步的结果,但是异步的弊端很大 例如:无法更好的处理…

【Linux】剧幕中的灵魂更迭:探索Shell下的程序替换

&#x1f3ac; 个人主页&#xff1a;谁在夜里看海. &#x1f4d6; 个人专栏&#xff1a;《C系列》《Linux系列》《算法系列》 ⛰️ 一念既出&#xff0c;万山无阻 目录 &#x1f4d6;一、进程程序替换 1.替换的演示 ❓替换与执行流 ❓程序替换≠进程替换 2.替换的原理 …