Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling-v3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张晓彤
integrated-scheduling-v3
Commits
5aa2b6ea
Commit
5aa2b6ea
authored
Nov 10, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库自动切换
parent
a6a359d8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
53 deletions
+5
-53
settings.py
settings.py
+0
-6
tables.py
tables.py
+5
-47
调度系统部署说明4.1.docx
调度系统部署说明4.1.docx
+0
-0
No files found.
settings.py
View file @
5aa2b6ea
...
...
@@ -25,12 +25,6 @@ with open(json_file) as f:
para_config
=
json
.
load
(
f
)[
"para"
]
with
open
(
json_file
)
as
f
:
mysql_config
=
json
.
load
(
f
)[
"mysql"
]
with
open
(
json_file
)
as
f
:
postgre_config
=
json
.
load
(
f
)[
"postgresql"
]
with
open
(
json_file
)
as
f
:
redis_config
=
json
.
load
(
f
)[
"redis"
]
# 全局参数
...
...
tables.py
View file @
5aa2b6ea
...
...
@@ -35,51 +35,6 @@ with open(json_file) as f:
else
:
sqlserver_config
=
None
# with open(json_file) as f:
# load_vale = json.load(f)
# if "mssql" in json.load(f):
# sqlserver_config = json.load(f)["mssql"]
# else:
# sqlserver_config = None
#
# with open(json_file) as f:
# postgre_config = json.load(f)["postgresql"]
# logger = get_logger("zxt.tables")
# # 创建对象的基类:
# Base = declarative_base()
#
# engine_mysql = create_engine(
# "mysql+mysqlconnector://root:%s@192.168.28.111:3306/waytous"
# % quote("Huituo@123")
# )
#
# engine_postgre = create_engine(
# "postgresql://postgres:%s@192.168.28.111:5432/shenbao_2021520"
# % quote("Huituo@123")
# )
# # 创建DBsession_mysql类型:
# DBsession_mysql = sessionmaker(bind=engine_mysql)
#
# DBsession_mysql = scoped_session(DBsession_mysql)
#
# DBsession_postgre = sessionmaker(bind=engine_postgre)
#
# DBsession_postgre = scoped_session(DBsession_postgre)
#
# # 创建session_mysql对象:
# session_mysql = DBsession_mysql()
#
# session_mysql.expire_on_commit = False
#
# session_postgre = DBsession_postgre()
#
# session_postgre.expire_on_commit = False
# 创建对象的基类:
Base
=
declarative_base
()
...
...
@@ -88,16 +43,19 @@ if mysql_config is not None:
sql_str
=
str
(
"mysql+mysqlconnector://"
+
mysql_config
[
"user"
]
+
":
%
s@"
+
mysql_config
[
"host"
]
+
\
":"
+
mysql_config
[
"port"
]
+
"/"
+
mysql_config
[
"database"
])
elif
sqlserver_config
is
not
None
:
engine_mysql
=
create_engine
(
sql_str
%
quote
(
mysql_config
[
"password"
]))
else
:
sql_str
=
str
(
"mssql+pymssql://"
+
sqlserver_config
[
"user"
]
+
":
%
s@"
+
sqlserver_config
[
"host"
]
+
\
":"
+
sqlserver_config
[
"port"
]
+
"/"
+
sqlserver_config
[
"database"
])
engine_mysql
=
create_engine
(
sql_str
%
quote
(
sqlserver_config
[
"password"
]))
postgre_str
=
str
(
"postgresql://"
+
postgre_config
[
"user"
]
+
":
%
s@"
+
postgre_config
[
"host"
]
+
\
":"
+
postgre_config
[
"port"
]
+
"/"
+
postgre_config
[
"database"
])
# try:
engine_mysql
=
create_engine
(
sql_str
%
quote
(
mysql_config
[
"password"
]))
engine_postgre
=
create_engine
(
postgre_str
%
quote
(
postgre_config
[
"password"
]))
...
...
调度系统部署说明4.1.docx
deleted
100644 → 0
View file @
a6a359d8
File deleted
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment