GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LearnPythonStats/codegen/codegen_load_db.py at master · elthe/LearnPythonStats

Expand file tree

/

codegen_load_db.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
57 lines (44 loc) · 1.27 KB
/

codegen_load_db.py

Copy path

File metadata and controls

57 lines (44 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
把EXCEL文件转成代码的模块信息字典
"""
import sys
from common import logcm
from common import loadcfgcm
from codegen.codegen_mdl import Module, Service, Bean, Code
from common import loadcfgcm
from common.dboraclecm import DbOracleClient
# 配置
default_config = """
{
"host": "localhost",
"port": 1521,
"db": "orcl",
"user": "root",
"passwd": "root"
}
"""
class CodeGenDBLoader:
"""
代码生成-DB加载类
"""
def __init__(self):
# 加载配置文件
self.cfg_db = loadcfgcm.load("codegen_loader_db.json", default_config)
def load_oracle_table(self, table_name):
"""
按照配置读取指定数据表名,载入模块数据
:param table_name: 数据表名
:return:数据表字典对象
"""
logcm.print_info("Loading table : %s ..." % table_name)
# 加载DB数据表模块信息
# 建立和数据库系统的连接
dbClient = DbOracleClient("oracle", self.cfg_db)
result = dbClient.getColumns(table_name)
logcm.print_obj(result, "result", show_table=True)
return result
if __name__ == '__main__':
loader = CodeGenDBLoader()
loader.load_oracle_table("T_CONTACTS")
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.