ApiLogicServer 14.3.25__py3-none-any.whl → 14.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- api_logic_server_cli/add_cust/add_cust.py +283 -0
- api_logic_server_cli/api_logic_server.py +18 -250
- api_logic_server_cli/api_logic_server_info.yaml +3 -3
- api_logic_server_cli/cli.py +54 -35
- api_logic_server_cli/create_from_model/__pycache__/api_logic_server_utils.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/create_db_from_model.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_create.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/api_logic_server_utils.py +47 -0
- api_logic_server_cli/create_from_model/create_db_from_model.py +2 -0
- api_logic_server_cli/create_from_model/dbml.py +113 -58
- api_logic_server_cli/create_from_model/ont_build.py +102 -74
- api_logic_server_cli/create_from_model/ont_create.py +7 -6
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/.DS_Store +0 -0
- api_logic_server_cli/database/basic_demo.sqlite +0 -0
- api_logic_server_cli/database/basic_demo.txt +1 -0
- api_logic_server_cli/database/basic_demo_wg.sqlite +0 -0
- api_logic_server_cli/database/nw-gold-fix.sql +62 -0
- api_logic_server_cli/database/nw-gold.sqlite +0 -0
- api_logic_server_cli/{prototypes/manager/webgenai → fragments}/docker-compose.yml +1 -1
- api_logic_server_cli/genai/genai.py +42 -11
- api_logic_server_cli/genai/genai_graphics.py +252 -38
- api_logic_server_cli/genai/genai_svcs.py +20 -12
- api_logic_server_cli/manager.py +22 -12
- api_logic_server_cli/prototypes/.DS_Store +0 -0
- api_logic_server_cli/prototypes/base/.DS_Store +0 -0
- api_logic_server_cli/prototypes/base/.vscode/launch.json +22 -2
- api_logic_server_cli/prototypes/base/api/expose_api_models.py +3 -1
- api_logic_server_cli/prototypes/base/api_logic_server_run.py +5 -2
- api_logic_server_cli/prototypes/base/config/activate_logicbank.py +1 -0
- api_logic_server_cli/prototypes/base/config/config.py +123 -25
- api_logic_server_cli/prototypes/base/config/default.env +7 -1
- api_logic_server_cli/prototypes/base/config/logging.yml +1 -0
- api_logic_server_cli/prototypes/base/config/server_setup.py +33 -1
- api_logic_server_cli/prototypes/base/database/test_data/readme.md +5 -2
- api_logic_server_cli/prototypes/base/devops/docker-standard-image/docker-compose-standard-image.yml +7 -2
- api_logic_server_cli/prototypes/base/docs/training/logic_bank_api.prompt +314 -0
- api_logic_server_cli/prototypes/base/docs/training/logic_example.py +41 -0
- api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +12 -5
- api_logic_server_cli/prototypes/base/integration/n8n/n8n_producer.py +68 -21
- api_logic_server_cli/prototypes/base/integration/n8n/n8n_readme.md +19 -0
- api_logic_server_cli/prototypes/base/integration/system/FlaskKafka.py +5 -1
- api_logic_server_cli/prototypes/base/test/basic/server_test.py +1 -1
- api_logic_server_cli/prototypes/base/ui/templates/bar_chart.jinja +64 -0
- api_logic_server_cli/prototypes/basic_demo/README.md +29 -52
- api_logic_server_cli/prototypes/basic_demo/customizations/api/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/mcp_server_executor.py +138 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/openapi.py +92 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/proper_update_def.json +71 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/config/default.env +13 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/models.py +131 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/1_langchain_loader.py +71 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/2_gpt_mcp_prompt.txt +19 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/README_mcp.md +13 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_client_executor.py +295 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_schema.txt +47 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_server_discovery.json +9 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_flow.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_orchestration.yaml +49 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/wny mcp flows.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/natlang_to_api.py +73 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/curl.txt +5 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP Overview.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Arch.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Overview_Executor.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/1 - prompt_messages_array.json +10 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/2 - completion_tool_context.json +12 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/llm_schema.txt +38 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_2.yaml +17393 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3.yaml +16660 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3_relaxed.yaml +109 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_server.py +51 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_serverZ.py +72 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/validate_jsonapi.py +64 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/run_executor.py +23 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/swagger_converter.py +65 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/z_old/3_executor_test_agent.py +52 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/3_executor_test_agent.py +52 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/README_functon.md +201 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/ai_plugin.json +17 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/nw-swagger_3.json +1731 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/snippets.txt +5 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3 genai_demo_with_get.json +1731 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3.json +1782 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo.json +264 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo_with_update.json +1782 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py +62 -44
- api_logic_server_cli/prototypes/basic_demo/customizations/security/declare_security.py +11 -12
- api_logic_server_cli/prototypes/basic_demo/customizations/ui/admin/admin.yaml +166 -0
- api_logic_server_cli/prototypes/basic_demo/iteration/api/{customize_api.py → api_discovery/order_b2b.py} +17 -23
- api_logic_server_cli/prototypes/basic_demo/iteration/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderB2B.py +6 -5
- api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderShipping.py +4 -4
- api_logic_server_cli/prototypes/basic_demo/iteration/logic/declare_logic.py +69 -43
- api_logic_server_cli/prototypes/basic_demo/iteration/ui/admin/admin.yaml +125 -50
- api_logic_server_cli/prototypes/genai_demo/ui/admin/admin.yaml +1 -1
- api_logic_server_cli/prototypes/manager/README.md +30 -4
- api_logic_server_cli/prototypes/manager/README_X.md +663 -0
- api_logic_server_cli/prototypes/manager/system/genai/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.prompt +0 -10
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example +32 -10
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_docs_logic/docs/002_create_db_models.prompt +4 -4
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_docs_logic/docs/003_create_db_models.response +77 -47
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_informal.prompt +1 -1
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/dashboard_services.jinja +83 -0
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/graphics_dashboard_WIP.py +34 -0
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/{graphics_services.py → graphics_services_api_xxx.py} +0 -9
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/graphics_services_db.jinja +46 -0
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/graphics_services_db_each_method.jinja +36 -0
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/graphics.prompt +7 -3
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/response_format.prompt +8 -1
- api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/install-ApiLogicServer-dev.ps1 +100 -0
- api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/install-ApiLogicServer-dev.sh +116 -0
- api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/readme.md +7 -0
- api_logic_server_cli/prototypes/manager/system/style-guide.yaml +2 -2
- api_logic_server_cli/prototypes/manager/webgenai/README.md +6 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/count_orders_by_category.prompt +1 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/order_count_by_month.prompt +1 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/request copy.json +892 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/request.json +6 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/response.json +17 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/response.yaml +59 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/sales_by_category.prompt +1 -0
- api_logic_server_cli/prototypes/nw/ui/admin/home.js +5 -4
- api_logic_server_cli/prototypes/nw/ui/app_model_custom.yaml +851 -1082
- api_logic_server_cli/prototypes/nw_no_cust/Tutorial.md +45 -26
- api_logic_server_cli/prototypes/nw_no_cust/api/api_discovery/openapi.py +130 -0
- api_logic_server_cli/prototypes/nw_no_cust/api/api_discovery/proper_update_def.json +71 -0
- api_logic_server_cli/prototypes/nw_no_cust/config/default.env +13 -0
- api_logic_server_cli/prototypes/nw_no_cust/docs/graphics/count_orders_by_category.prompt +1 -0
- api_logic_server_cli/prototypes/nw_no_cust/docs/graphics/sales_by_employee.prompt +1 -0
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/nginx/nginx.conf +2 -2
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/package-lock.json +9725 -1180
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/package.json +6 -9
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/app/app.config.ts +2 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/app/shared/app.services.config.ts +1 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/css/app.scss +4 -0
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/i18n/en.json +1 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/i18n/es.json +14 -12
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/environments/environment.prod.ts +5 -5
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/environments/environment.ts +5 -5
- api_logic_server_cli/prototypes/ont_app/templates/app_config.jinja +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/date_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/detail_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/new_template.html +16 -16
- api_logic_server_cli/prototypes/ont_app/templates/textarea_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/timestamp_template.html +1 -1
- api_logic_server_cli/prototypes/sample_ai/logic/declare_logic.py +30 -13
- apilogicserver-14.5.0.dist-info/METADATA +76 -0
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/RECORD +160 -88
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/WHEEL +1 -1
- api_logic_server_cli/prototypes/basic_demo/apply_customizations.ps1 +0 -17
- api_logic_server_cli/prototypes/basic_demo/apply_customizations.sh +0 -14
- api_logic_server_cli/prototypes/basic_demo/apply_iteration.ps1 +0 -20
- api_logic_server_cli/prototypes/basic_demo/apply_iteration.sh +0 -15
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/service_template_jsonapi_rpc.jinja +0 -37
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/service_template_unused.jinja +0 -38
- apilogicserver-14.3.25.dist-info/METADATA +0 -167
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/entry_points.txt +0 -0
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"role": "user",
|
|
4
|
+
"content": "You are a data modelling expert and python software architect who expands on user input ideas.
|
|
5
|
+
|
|
6
|
+
<responseFormat>
|
|
7
|
+
class Rule(BaseModel):
|
|
8
|
+
name: str
|
|
9
|
+
description: str
|
|
10
|
+
use_case: str # specified use case or requirement name (use 'General' if missing)
|
|
11
|
+
entity: str # the entity being constrained or derived
|
|
12
|
+
code: str # logicbank rule code
|
|
13
|
+
|
|
14
|
+
class Model(BaseModel):
|
|
15
|
+
classname: str
|
|
16
|
+
code: str # sqlalchemy model code
|
|
17
|
+
sqlite_create: str # sqlite create table statement
|
|
18
|
+
description: str
|
|
19
|
+
name: str
|
|
20
|
+
|
|
21
|
+
class TestDataRow(BaseModel):
|
|
22
|
+
test_data_row_variable: str # the Python test data row variable
|
|
23
|
+
code: str # Python code to create a test data row instance
|
|
24
|
+
|
|
25
|
+
class Graphic(BaseModel):
|
|
26
|
+
sqlalchemy_query: str # sqlalchemy query using group by, returns result = { \"result\": [ (\"name\", \"value\") ] }
|
|
27
|
+
classes_used: str # comma-delimited list of classes used in sqlalchemy_query
|
|
28
|
+
name: str # suggested Python name for sqlalchemy_query
|
|
29
|
+
html_code: str # create a java script app to show a bar chart from sqlalchemy_query result
|
|
30
|
+
|
|
31
|
+
class WGResult(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
|
|
32
|
+
# response: str # result
|
|
33
|
+
models : List[Model] # list of sqlalchemy classes in the response
|
|
34
|
+
rules : List[Rule] # list rule declarations
|
|
35
|
+
graphics: List[Graphic] # list of Graphic objects
|
|
36
|
+
test_data: str
|
|
37
|
+
test_data_rows: List[TestDataRow] # list of test data rows
|
|
38
|
+
test_data_sqlite: str # test data as sqlite INSERT statements
|
|
39
|
+
name: str # suggest a short name for the project
|
|
40
|
+
|
|
41
|
+
Format the response as a WGResult.
|
|
42
|
+
|
|
43
|
+
</responseFormat>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Create WGResult Graphics for prompts like 'graph sales by region'.
|
|
47
|
+
* use 'sales by region' to create a WGResult Graphic.sqlalchemy_query
|
|
48
|
+
* Be sure to use class names, not table names
|
|
49
|
+
* for example, using Northwind:
|
|
50
|
+
# SQLAlchemy query for Sales by Category
|
|
51
|
+
sales_by_category = (
|
|
52
|
+
session.query(
|
|
53
|
+
category.CategoryName,
|
|
54
|
+
func.sum(order_detail.Quantity * order_detail.UnitPrice * (1 - order_detail.Discount)).label(\"TotalSales\")
|
|
55
|
+
)
|
|
56
|
+
.join(product, category.Id == product.CategoryId)
|
|
57
|
+
.join(order_detail, product.Id == order_detail.ProductId)
|
|
58
|
+
.join(order, order_detail.OrderId == order.Id)
|
|
59
|
+
.filter(order.ShippedDate.isnot(None)) # Consider only shipped orders
|
|
60
|
+
.group_by(category.CategoryName)
|
|
61
|
+
.order_by(func.sum(order_detail.Quantity * order_detail.UnitPrice * (1 - order_detail.Discount)).desc())
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# coding: utf-8
|
|
65
|
+
|
|
66
|
+
from sqlalchemy import DECIMAL, DateTime # API Logic Server GenAI assist
|
|
67
|
+
|
|
68
|
+
from sqlalchemy import Boolean, Column, DECIMAL, Date, Double, ForeignKey, ForeignKeyConstraint, Integer, String, Table, Text, text
|
|
69
|
+
|
|
70
|
+
from sqlalchemy.orm import relationship
|
|
71
|
+
|
|
72
|
+
from sqlalchemy.ext.declarative import declarative_base
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
########################################################################################################################
|
|
77
|
+
|
|
78
|
+
# Classes describing database for SqlAlchemy ORM, initially created by schema introspection.
|
|
79
|
+
|
|
80
|
+
#
|
|
81
|
+
|
|
82
|
+
# Alter this file per your database maintenance policy
|
|
83
|
+
|
|
84
|
+
# See https://apilogicserver.github.io/Docs/Project-Rebuild/#rebuilding
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
|
|
88
|
+
# Created: March 25, 2025 19:54:24
|
|
89
|
+
|
|
90
|
+
# Database: sqlite:////Users/val/dev/ApiLogicServer/ApiLogicServer-dev/build_and_test/ApiLogicServer/samples/nw_sample_nocust/database/db.sqlite
|
|
91
|
+
|
|
92
|
+
# Dialect: sqlite
|
|
93
|
+
|
|
94
|
+
#
|
|
95
|
+
|
|
96
|
+
# mypy: ignore-errors
|
|
97
|
+
|
|
98
|
+
########################################################################################################################
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
from database.system.SAFRSBaseX import SAFRSBaseX, TestBase
|
|
103
|
+
|
|
104
|
+
from flask_login import UserMixin
|
|
105
|
+
|
|
106
|
+
import safrs, flask_sqlalchemy, os
|
|
107
|
+
|
|
108
|
+
from safrs import jsonapi_attr
|
|
109
|
+
|
|
110
|
+
from flask_sqlalchemy import SQLAlchemy
|
|
111
|
+
|
|
112
|
+
from sqlalchemy.orm import relationship
|
|
113
|
+
|
|
114
|
+
from sqlalchemy.orm import Mapped
|
|
115
|
+
|
|
116
|
+
from sqlalchemy.sql.sqltypes import NullType
|
|
117
|
+
|
|
118
|
+
from typing import List
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
db = SQLAlchemy()
|
|
123
|
+
|
|
124
|
+
Base = declarative_base() # type: flask_sqlalchemy.model.DefaultMeta
|
|
125
|
+
|
|
126
|
+
metadata = Base.metadata
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
#NullType = db.String # datatype fixup
|
|
131
|
+
|
|
132
|
+
#TIMESTAMP= db.TIMESTAMP
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
from sqlalchemy.dialects.sqlite import *
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if os.getenv('APILOGICPROJECT_NO_FLASK') is None or os.getenv('APILOGICPROJECT_NO_FLASK') == 'None':
|
|
141
|
+
|
|
142
|
+
Base = SAFRSBaseX # enables rules to be used outside of Flask, e.g., test data loading
|
|
143
|
+
|
|
144
|
+
else:
|
|
145
|
+
|
|
146
|
+
Base = TestBase # ensure proper types, so rules work for data loading
|
|
147
|
+
|
|
148
|
+
print('*** Models.py Using TestBase ***')
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class Category(Base): # type: ignore
|
|
157
|
+
|
|
158
|
+
__tablename__ = 'CategoryTableNameTest'
|
|
159
|
+
|
|
160
|
+
_s_collection_name = 'Category' # type: ignore
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
Id = Column(Integer, primary_key=True)
|
|
165
|
+
|
|
166
|
+
CategoryName_ColumnName = Column(String(8000))
|
|
167
|
+
|
|
168
|
+
Description = Column(String(8000))
|
|
169
|
+
|
|
170
|
+
Client_id = Column(Integer)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# parent relationships (access parent)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
# child relationships (access children)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class Customer(Base): # type: ignore
|
|
187
|
+
|
|
188
|
+
__tablename__ = 'Customer'
|
|
189
|
+
|
|
190
|
+
_s_collection_name = 'Customer' # type: ignore
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
Id = Column(String(8000), primary_key=True)
|
|
195
|
+
|
|
196
|
+
CompanyName = Column(String(8000))
|
|
197
|
+
|
|
198
|
+
ContactName = Column(String(8000))
|
|
199
|
+
|
|
200
|
+
ContactTitle = Column(String(8000))
|
|
201
|
+
|
|
202
|
+
Address = Column(String(8000))
|
|
203
|
+
|
|
204
|
+
City = Column(String(8000))
|
|
205
|
+
|
|
206
|
+
Region = Column(String(8000))
|
|
207
|
+
|
|
208
|
+
PostalCode = Column(String(8000))
|
|
209
|
+
|
|
210
|
+
Country = Column(String(8000))
|
|
211
|
+
|
|
212
|
+
Phone = Column(String(8000))
|
|
213
|
+
|
|
214
|
+
Fax = Column(String(8000))
|
|
215
|
+
|
|
216
|
+
Balance : DECIMAL = Column(DECIMAL)
|
|
217
|
+
|
|
218
|
+
CreditLimit : DECIMAL = Column(DECIMAL)
|
|
219
|
+
|
|
220
|
+
OrderCount = Column(Integer, server_default=text(\"0\"))
|
|
221
|
+
|
|
222
|
+
UnpaidOrderCount = Column(Integer, server_default=text(\"0\"))
|
|
223
|
+
|
|
224
|
+
Client_id = Column(Integer)
|
|
225
|
+
|
|
226
|
+
allow_client_generated_ids = True
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# parent relationships (access parent)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# child relationships (access children)
|
|
235
|
+
|
|
236
|
+
OrderList : Mapped[List[\"Order\"]] = relationship(back_populates=\"Customer\")
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class CustomerDemographic(Base): # type: ignore
|
|
245
|
+
|
|
246
|
+
__tablename__ = 'CustomerDemographic'
|
|
247
|
+
|
|
248
|
+
_s_collection_name = 'CustomerDemographic' # type: ignore
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
Id = Column(String(8000), primary_key=True)
|
|
253
|
+
|
|
254
|
+
CustomerDesc = Column(String(8000))
|
|
255
|
+
|
|
256
|
+
allow_client_generated_ids = True
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
# parent relationships (access parent)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
# child relationships (access children)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class Department(Base): # type: ignore
|
|
273
|
+
|
|
274
|
+
__tablename__ = 'Department'
|
|
275
|
+
|
|
276
|
+
_s_collection_name = 'Department' # type: ignore
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
Id = Column(Integer, primary_key=True)
|
|
281
|
+
|
|
282
|
+
DepartmentId = Column(ForeignKey('Department.Id'))
|
|
283
|
+
|
|
284
|
+
DepartmentName = Column(String(100))
|
|
285
|
+
|
|
286
|
+
SecurityLevel = Column(Integer, server_default=text(\"0\"))
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# parent relationships (access parent)
|
|
291
|
+
|
|
292
|
+
Department : Mapped[\"Department\"] = relationship(remote_side=[Id], back_populates=(\"DepartmentList\"))
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
# child relationships (access children)
|
|
297
|
+
|
|
298
|
+
DepartmentList : Mapped[List[\"Department\"]] = relationship(back_populates=\"Department\")
|
|
299
|
+
|
|
300
|
+
EmployeeList : Mapped[List[\"Employee\"]] = relationship(foreign_keys='[Employee.OnLoanDepartmentId]', back_populates=\"OnLoanDepartment\")
|
|
301
|
+
|
|
302
|
+
WorksForEmployeeList : Mapped[List[\"Employee\"]] = relationship(foreign_keys='[Employee.WorksForDepartmentId]', back_populates=\"WorksForDepartment\")
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class Location(Base): # type: ignore
|
|
311
|
+
|
|
312
|
+
__tablename__ = 'Location'
|
|
313
|
+
|
|
314
|
+
_s_collection_name = 'Location' # type: ignore
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
country = Column(String(50), primary_key=True)
|
|
319
|
+
|
|
320
|
+
city = Column(String(50), primary_key=True)
|
|
321
|
+
|
|
322
|
+
notes = Column(String(256))
|
|
323
|
+
|
|
324
|
+
allow_client_generated_ids = True
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
# parent relationships (access parent)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
# child relationships (access children)
|
|
333
|
+
|
|
334
|
+
OrderList : Mapped[List[\"Order\"]] = relationship(back_populates=\"Location\")
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class Product(Base): # type: ignore
|
|
343
|
+
|
|
344
|
+
__tablename__ = 'Product'
|
|
345
|
+
|
|
346
|
+
_s_collection_name = 'Product' # type: ignore
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
Id = Column(Integer, primary_key=True)
|
|
351
|
+
|
|
352
|
+
ProductName = Column(String(8000))
|
|
353
|
+
|
|
354
|
+
SupplierId = Column(Integer, nullable=False)
|
|
355
|
+
|
|
356
|
+
CategoryId = Column(Integer, nullable=False)
|
|
357
|
+
|
|
358
|
+
QuantityPerUnit = Column(String(8000))
|
|
359
|
+
|
|
360
|
+
UnitPrice : DECIMAL = Column(DECIMAL, nullable=False)
|
|
361
|
+
|
|
362
|
+
UnitsInStock = Column(Integer, nullable=False)
|
|
363
|
+
|
|
364
|
+
UnitsOnOrder = Column(Integer, nullable=False)
|
|
365
|
+
|
|
366
|
+
ReorderLevel = Column(Integer, nullable=False)
|
|
367
|
+
|
|
368
|
+
Discontinued = Column(Integer, nullable=False)
|
|
369
|
+
|
|
370
|
+
UnitsShipped = Column(Integer)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
# parent relationships (access parent)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
# child relationships (access children)
|
|
379
|
+
|
|
380
|
+
OrderDetailList : Mapped[List[\"OrderDetail\"]] = relationship(back_populates=\"Product\")
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
t_ProductDetails_View = Table(
|
|
389
|
+
|
|
390
|
+
'ProductDetails_View', metadata,
|
|
391
|
+
|
|
392
|
+
Column('Id', Integer),
|
|
393
|
+
|
|
394
|
+
Column('ProductName', String(8000)),
|
|
395
|
+
|
|
396
|
+
Column('SupplierId', Integer),
|
|
397
|
+
|
|
398
|
+
Column('CategoryId', Integer),
|
|
399
|
+
|
|
400
|
+
Column('QuantityPerUnit', String(8000)),
|
|
401
|
+
|
|
402
|
+
Column('UnitPrice', DECIMAL),
|
|
403
|
+
|
|
404
|
+
Column('UnitsInStock', Integer),
|
|
405
|
+
|
|
406
|
+
Column('UnitsOnOrder', Integer),
|
|
407
|
+
|
|
408
|
+
Column('ReorderLevel', Integer),
|
|
409
|
+
|
|
410
|
+
Column('Discontinued', Integer),
|
|
411
|
+
|
|
412
|
+
Column('UnitsShipped', Integer),
|
|
413
|
+
|
|
414
|
+
Column('CategoryName_ColumnName', String(8000)),
|
|
415
|
+
|
|
416
|
+
Column('CategoryDescription', String(8000)),
|
|
417
|
+
|
|
418
|
+
Column('SupplierName', String(8000)),
|
|
419
|
+
|
|
420
|
+
Column('SupplierRegion', String(8000))
|
|
421
|
+
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
class Region(Base): # type: ignore
|
|
429
|
+
|
|
430
|
+
__tablename__ = 'Region'
|
|
431
|
+
|
|
432
|
+
_s_collection_name = 'Region' # type: ignore
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
Id = Column(Integer, primary_key=True)
|
|
437
|
+
|
|
438
|
+
RegionDescription = Column(String(8000))
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
# parent relationships (access parent)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
# child relationships (access children)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
class SampleDBVersion(Base): # type: ignore
|
|
455
|
+
|
|
456
|
+
__tablename__ = 'SampleDBVersion'
|
|
457
|
+
|
|
458
|
+
_s_collection_name = 'SampleDBVersion' # type: ignore
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
Id = Column(Integer, primary_key=True)
|
|
463
|
+
|
|
464
|
+
Notes = Column(String(800))
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
# parent relationships (access parent)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
# child relationships (access children)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class Shipper(Base): # type: ignore
|
|
481
|
+
|
|
482
|
+
__tablename__ = 'Shipper'
|
|
483
|
+
|
|
484
|
+
_s_collection_name = 'Shipper' # type: ignore
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
Id = Column(Integer, primary_key=True)
|
|
489
|
+
|
|
490
|
+
CompanyName = Column(String(8000))
|
|
491
|
+
|
|
492
|
+
Phone = Column(String(8000))
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
# parent relationships (access parent)
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
# child relationships (access children)
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
class Supplier(Base): # type: ignore
|
|
509
|
+
|
|
510
|
+
__tablename__ = 'Supplier'
|
|
511
|
+
|
|
512
|
+
_s_collection_name = 'Supplier' # type: ignore
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
Id = Column(Integer, primary_key=True)
|
|
517
|
+
|
|
518
|
+
CompanyName = Column(String(8000))
|
|
519
|
+
|
|
520
|
+
ContactName = Column(String(8000))
|
|
521
|
+
|
|
522
|
+
ContactTitle = Column(String(8000))
|
|
523
|
+
|
|
524
|
+
Address = Column(String(8000))
|
|
525
|
+
|
|
526
|
+
City = Column(String(8000))
|
|
527
|
+
|
|
528
|
+
Region = Column(String(8000))
|
|
529
|
+
|
|
530
|
+
PostalCode = Column(String(8000))
|
|
531
|
+
|
|
532
|
+
Country = Column(String(8000))
|
|
533
|
+
|
|
534
|
+
Phone = Column(String(8000))
|
|
535
|
+
|
|
536
|
+
Fax = Column(String(8000))
|
|
537
|
+
|
|
538
|
+
HomePage = Column(String(8000))
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
# parent relationships (access parent)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
# child relationships (access children)
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
class Territory(Base): # type: ignore
|
|
555
|
+
|
|
556
|
+
__tablename__ = 'Territory'
|
|
557
|
+
|
|
558
|
+
_s_collection_name = 'Territory' # type: ignore
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
Id = Column(String(8000), primary_key=True)
|
|
563
|
+
|
|
564
|
+
TerritoryDescription = Column(String(8000))
|
|
565
|
+
|
|
566
|
+
RegionId = Column(Integer, nullable=False)
|
|
567
|
+
|
|
568
|
+
allow_client_generated_ids = True
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
# parent relationships (access parent)
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
# child relationships (access children)
|
|
577
|
+
|
|
578
|
+
EmployeeTerritoryList : Mapped[List[\"EmployeeTerritory\"]] = relationship(back_populates=\"Territory\")
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
class Union(Base): # type: ignore
|
|
587
|
+
|
|
588
|
+
__tablename__ = 'Union'
|
|
589
|
+
|
|
590
|
+
_s_collection_name = 'Union' # type: ignore
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
Id = Column(Integer, primary_key=True)
|
|
595
|
+
|
|
596
|
+
Name = Column(String(80))
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
# parent relationships (access parent)
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
# child relationships (access children)
|
|
605
|
+
|
|
606
|
+
EmployeeList : Mapped[List[\"Employee\"]] = relationship(back_populates=\"Union\")
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
class Employee(Base): # type: ignore
|
|
615
|
+
|
|
616
|
+
__tablename__ = 'Employee'
|
|
617
|
+
|
|
618
|
+
_s_collection_name = 'Employee' # type: ignore
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
Id = Column(Integer, primary_key=True)
|
|
623
|
+
|
|
624
|
+
LastName = Column(String(8000))
|
|
625
|
+
|
|
626
|
+
FirstName = Column(String(8000))
|
|
627
|
+
|
|
628
|
+
Title = Column(String(8000))
|
|
629
|
+
|
|
630
|
+
TitleOfCourtesy = Column(String(8000))
|
|
631
|
+
|
|
632
|
+
BirthDate = Column(String(8000))
|
|
633
|
+
|
|
634
|
+
HireDate = Column(String(8000))
|
|
635
|
+
|
|
636
|
+
Address = Column(String(8000))
|
|
637
|
+
|
|
638
|
+
City = Column(String(8000))
|
|
639
|
+
|
|
640
|
+
Region = Column(String(8000))
|
|
641
|
+
|
|
642
|
+
PostalCode = Column(String(8000))
|
|
643
|
+
|
|
644
|
+
Country = Column(String(8000))
|
|
645
|
+
|
|
646
|
+
HomePhone = Column(String(8000))
|
|
647
|
+
|
|
648
|
+
Extension = Column(String(8000))
|
|
649
|
+
|
|
650
|
+
Notes = Column(String(8000))
|
|
651
|
+
|
|
652
|
+
ReportsTo = Column(Integer, index=True)
|
|
653
|
+
|
|
654
|
+
PhotoPath = Column(String(8000))
|
|
655
|
+
|
|
656
|
+
EmployeeType = Column(String(16), server_default=text(\"Salaried\"))
|
|
657
|
+
|
|
658
|
+
Salary : DECIMAL = Column(DECIMAL)
|
|
659
|
+
|
|
660
|
+
WorksForDepartmentId = Column(ForeignKey('Department.Id'))
|
|
661
|
+
|
|
662
|
+
OnLoanDepartmentId = Column(ForeignKey('Department.Id'))
|
|
663
|
+
|
|
664
|
+
UnionId = Column(ForeignKey('Union.Id'))
|
|
665
|
+
|
|
666
|
+
Dues : DECIMAL = Column(DECIMAL)
|
|
667
|
+
|
|
668
|
+
Email = Column(Text)
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
# parent relationships (access parent)
|
|
673
|
+
|
|
674
|
+
OnLoanDepartment : Mapped[\"Department\"] = relationship(foreign_keys='[Employee.OnLoanDepartmentId]', back_populates=(\"EmployeeList\"))
|
|
675
|
+
|
|
676
|
+
Union : Mapped[\"Union\"] = relationship(back_populates=(\"EmployeeList\"))
|
|
677
|
+
|
|
678
|
+
WorksForDepartment : Mapped[\"Department\"] = relationship(foreign_keys='[Employee.WorksForDepartmentId]', back_populates=(\"WorksForEmployeeList\"))
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
# child relationships (access children)
|
|
683
|
+
|
|
684
|
+
EmployeeAuditList : Mapped[List[\"EmployeeAudit\"]] = relationship(back_populates=\"Employee\")
|
|
685
|
+
|
|
686
|
+
EmployeeTerritoryList : Mapped[List[\"EmployeeTerritory\"]] = relationship(back_populates=\"Employee\")
|
|
687
|
+
|
|
688
|
+
OrderList : Mapped[List[\"Order\"]] = relationship(back_populates=\"Employee\")
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
class EmployeeAudit(Base): # type: ignore
|
|
697
|
+
|
|
698
|
+
__tablename__ = 'EmployeeAudit'
|
|
699
|
+
|
|
700
|
+
_s_collection_name = 'EmployeeAudit' # type: ignore
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
Id = Column(Integer, primary_key=True)
|
|
705
|
+
|
|
706
|
+
Title = Column(String)
|
|
707
|
+
|
|
708
|
+
Salary : DECIMAL = Column(DECIMAL)
|
|
709
|
+
|
|
710
|
+
LastName = Column(String)
|
|
711
|
+
|
|
712
|
+
FirstName = Column(String)
|
|
713
|
+
|
|
714
|
+
EmployeeId = Column(ForeignKey('Employee.Id'))
|
|
715
|
+
|
|
716
|
+
CreatedOn = Column(Text)
|
|
717
|
+
|
|
718
|
+
UpdatedOn = Column(Text)
|
|
719
|
+
|
|
720
|
+
CreatedBy = Column(Text)
|
|
721
|
+
|
|
722
|
+
UpdatedBy = Column(Text)
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
# parent relationships (access parent)
|
|
727
|
+
|
|
728
|
+
Employee : Mapped[\"Employee\"] = relationship(back_populates=(\"EmployeeAuditList\"))
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
# child relationships (access children)
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
class EmployeeTerritory(Base): # type: ignore
|
|
741
|
+
|
|
742
|
+
__tablename__ = 'EmployeeTerritory'
|
|
743
|
+
|
|
744
|
+
_s_collection_name = 'EmployeeTerritory' # type: ignore
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
Id = Column(String(8000), primary_key=True)
|
|
749
|
+
|
|
750
|
+
EmployeeId = Column(ForeignKey('Employee.Id'), nullable=False)
|
|
751
|
+
|
|
752
|
+
TerritoryId = Column(ForeignKey('Territory.Id'))
|
|
753
|
+
|
|
754
|
+
allow_client_generated_ids = True
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
# parent relationships (access parent)
|
|
759
|
+
|
|
760
|
+
Employee : Mapped[\"Employee\"] = relationship(back_populates=(\"EmployeeTerritoryList\"))
|
|
761
|
+
|
|
762
|
+
Territory : Mapped[\"Territory\"] = relationship(back_populates=(\"EmployeeTerritoryList\"))
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
# child relationships (access children)
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
class Order(Base): # type: ignore
|
|
775
|
+
|
|
776
|
+
__tablename__ = 'Order'
|
|
777
|
+
|
|
778
|
+
_s_collection_name = 'Order' # type: ignore
|
|
779
|
+
|
|
780
|
+
__table_args__ = (
|
|
781
|
+
|
|
782
|
+
ForeignKeyConstraint(['Country', 'City'], ['Location.country', 'Location.city']),
|
|
783
|
+
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
Id = Column(Integer, primary_key=True)
|
|
789
|
+
|
|
790
|
+
CustomerId = Column(ForeignKey('Customer.Id'), nullable=False, index=True)
|
|
791
|
+
|
|
792
|
+
EmployeeId = Column(ForeignKey('Employee.Id'), nullable=False, index=True)
|
|
793
|
+
|
|
794
|
+
OrderDate = Column(String(8000))
|
|
795
|
+
|
|
796
|
+
RequiredDate = Column(Date)
|
|
797
|
+
|
|
798
|
+
ShippedDate = Column(String(8000))
|
|
799
|
+
|
|
800
|
+
ShipVia = Column(Integer)
|
|
801
|
+
|
|
802
|
+
Freight : DECIMAL = Column(DECIMAL, server_default=text(\"0\"))
|
|
803
|
+
|
|
804
|
+
ShipName = Column(String(8000))
|
|
805
|
+
|
|
806
|
+
ShipAddress = Column(String(8000))
|
|
807
|
+
|
|
808
|
+
ShipCity = Column(String(8000))
|
|
809
|
+
|
|
810
|
+
ShipRegion = Column(String(8000))
|
|
811
|
+
|
|
812
|
+
ShipPostalCode = Column(String(8000))
|
|
813
|
+
|
|
814
|
+
ShipCountry = Column(String(8000))
|
|
815
|
+
|
|
816
|
+
AmountTotal : DECIMAL = Column(DECIMAL(10, 2))
|
|
817
|
+
|
|
818
|
+
Country = Column(String(50))
|
|
819
|
+
|
|
820
|
+
City = Column(String(50))
|
|
821
|
+
|
|
822
|
+
Ready = Column(Boolean)
|
|
823
|
+
|
|
824
|
+
OrderDetailCount = Column(Integer, server_default=text(\"0\"))
|
|
825
|
+
|
|
826
|
+
CloneFromOrder = Column(ForeignKey('Order.Id'))
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
# parent relationships (access parent)
|
|
831
|
+
|
|
832
|
+
Order : Mapped[\"Order\"] = relationship(remote_side=[Id], back_populates=(\"OrderList\"))
|
|
833
|
+
|
|
834
|
+
Location : Mapped[\"Location\"] = relationship(back_populates=(\"OrderList\"))
|
|
835
|
+
|
|
836
|
+
Customer : Mapped[\"Customer\"] = relationship(back_populates=(\"OrderList\"))
|
|
837
|
+
|
|
838
|
+
Employee : Mapped[\"Employee\"] = relationship(back_populates=(\"OrderList\"))
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
# child relationships (access children)
|
|
843
|
+
|
|
844
|
+
OrderList : Mapped[List[\"Order\"]] = relationship(back_populates=\"Order\")
|
|
845
|
+
|
|
846
|
+
OrderDetailList : Mapped[List[\"OrderDetail\"]] = relationship(back_populates=\"Order\")
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
class OrderDetail(Base): # type: ignore
|
|
855
|
+
|
|
856
|
+
__tablename__ = 'OrderDetail'
|
|
857
|
+
|
|
858
|
+
_s_collection_name = 'OrderDetail' # type: ignore
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
Id = Column(Integer, primary_key=True)
|
|
863
|
+
|
|
864
|
+
OrderId = Column(ForeignKey('Order.Id'), nullable=False, index=True)
|
|
865
|
+
|
|
866
|
+
ProductId = Column(ForeignKey('Product.Id'), nullable=False, index=True)
|
|
867
|
+
|
|
868
|
+
UnitPrice : DECIMAL = Column(DECIMAL)
|
|
869
|
+
|
|
870
|
+
Quantity = Column(Integer, server_default=text(\"1\"), nullable=False)
|
|
871
|
+
|
|
872
|
+
Discount = Column(Double, server_default=text(\"0\"))
|
|
873
|
+
|
|
874
|
+
Amount : DECIMAL = Column(DECIMAL)
|
|
875
|
+
|
|
876
|
+
ShippedDate = Column(String(8000))
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
# parent relationships (access parent)
|
|
881
|
+
|
|
882
|
+
Order : Mapped[\"Order\"] = relationship(back_populates=(\"OrderDetailList\"))
|
|
883
|
+
|
|
884
|
+
Product : Mapped[\"Product\"] = relationship(back_populates=(\"OrderDetailList\"))
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
# child relationships (access children)
|
|
889
|
+
|
|
890
|
+
Graph Sales by Category"
|
|
891
|
+
}
|
|
892
|
+
]
|