-
Notifications
You must be signed in to change notification settings - Fork 22
/
tvf.txt
144 lines (112 loc) · 4.13 KB
/
tvf.txt
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# coding: utf-8
from sqlalchemy import Boolean, Column, DECIMAL, DateTime, Float, ForeignKey, Integer, LargeBinary, String, Table, Text, UniqueConstraint, text
from sqlalchemy.orm import relationship
from sqlalchemy.sql.sqltypes import NullType
from sqlalchemy.ext.declarative import declarative_base
from flask_sqlalchemy import SQLAlchemy
from safrs import SAFRSAPI, jsonapi_rpc
from safrs import JABase, DB
########################################################################################################################
# Classes describing database for SqlAlchemy ORM, initially created by schema introspection.
#
from safrs import SAFRSBase
import safrs
db = safrs.DB
Base = db.Model
metadata = Base.metadata
NullType = db.String # datatype fixup
TIMESTAMP= db.TIMESTAMP
from sqlalchemy.dialects.mysql import *
########################################################################################################################
t_fn_Data_u_CDM_BusinessProcess_yyyy = Table( # define result for fn_Data_u_CDM_BusinessProcess_yyyy
"fn_Data_u_CDM_BusinessProcess_yyyy", metadata,
Column("Document", String(8000)))
t_fn_Get_COD111 = Table( # define result for fn_Get_COD111
"fn_Get_COD111", metadata,
Column("char_type", String(8000)),
Column("Key", String(10)),
Column("varchar_type", String(8000)))
t_udfEmployeeInLocation = Table( # define result for udfEmployeeInLocation
"udfEmployeeInLocation", metadata,
Column("Id", Integer),
Column("Location", String(50)),
Column("Name", String(50)))
t_udfEmployeeInLocationWithName = Table( # define result for udfEmployeeInLocationWithName
"udfEmployeeInLocationWithName", metadata,
Column("Id", Integer),
Column("Location", String(50)),
Column("Name", String(50)))
class fn_Data_u_CDM_BusinessProcess_yyyy(JABase):
"""
description: define service for fn_Data_u_CDM_BusinessProcess_yyyy
"""
_s_type = "fn_Data_u_CDM_BusinessProcess_yyyy"
@staticmethod
@jsonapi_rpc(http_methods=['POST'], valid_jsonapi=False)
def fn_Data_u_CDM_BusinessProcess_yyyy():
"""
description: expose TVF - fn_Data_u_CDM_BusinessProcess_yyyy
args:
"""
sql_query = db.text("SELECT * FROM fn_Data_u_CDM_BusinessProcess_yyyy()")
query_result = db.engine.execute(sql_query, )
result = query_result.fetchall()
return {"result" : list(result)}
class fn_Get_COD111(JABase):
"""
description: define service for fn_Get_COD111
"""
_s_type = "fn_Get_COD111"
@staticmethod
@jsonapi_rpc(http_methods=['POST'], valid_jsonapi=False)
def fn_Get_COD111(Key):
"""
description: expose TVF - fn_Get_COD111
args:
Key : value
"""
sql_query = db.text("SELECT * FROM fn_Get_COD111(:Key)")
query_result = db.engine.execute(sql_query, Key=Key)
result = query_result.fetchall()
return {"result" : list(result)}
class udfEmployeeInLocation(JABase):
"""
description: define service for udfEmployeeInLocation
"""
_s_type = "udfEmployeeInLocation"
@staticmethod
@jsonapi_rpc(http_methods=['POST'], valid_jsonapi=False)
def udfEmployeeInLocation(location):
"""
description: expose TVF - udfEmployeeInLocation
args:
location : value
"""
sql_query = db.text("SELECT * FROM udfEmployeeInLocation(:location)")
query_result = db.engine.execute(sql_query, location=location)
result = query_result.fetchall()
return {"result" : list(result)}
class udfEmployeeInLocationWithName(JABase):
"""
description: define service for udfEmployeeInLocationWithName
"""
_s_type = "udfEmployeeInLocationWithName"
@staticmethod
@jsonapi_rpc(http_methods=['POST'], valid_jsonapi=False)
def udfEmployeeInLocationWithName(location, Name):
"""
description: expose TVF - udfEmployeeInLocationWithName
args:
location : value
Name : value
"""
sql_query = db.text("SELECT * FROM udfEmployeeInLocationWithName(:location, :Name)")
query_result = db.engine.execute(sql_query, location=location, Name=Name)
result = query_result.fetchall()
return {"result" : list(result)}
def expose_tvfs(api):
api.expose_object(fn_Data_u_CDM_BusinessProcess_yyyy)
api.expose_object(fn_Get_COD111)
api.expose_object(udfEmployeeInLocation)
api.expose_object(udfEmployeeInLocationWithName)
# 4 services created.