Skip to content

Commit

Permalink
fix: #390 special pwd bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
csunny committed Dec 6, 2023
1 parent 063c4fe commit bc6ca11
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 52 deletions.
19 changes: 2 additions & 17 deletions pilot/base_modules/meta_data/meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@

if CFG.LOCAL_DB_TYPE == "mysql":
engine_temp = create_engine(
f"mysql+pymysql://"
+ quote(CFG.LOCAL_DB_USER)
+ ":"
+ urlquote(CFG.LOCAL_DB_PASSWORD)
+ "@"
+ CFG.LOCAL_DB_HOST
+ ":"
+ str(CFG.LOCAL_DB_PORT)
f"mysql+pymysql://{quote(CFG.LOCAL_DB_USER)}:{urlquote(CFG.LOCAL_DB_PASSWORD)}@{CFG.LOCAL_DB_HOST}:{str(CFG.LOCAL_DB_PORT)}"
)
# check and auto create mysqldatabase
try:
Expand All @@ -52,15 +45,7 @@
logger.error(f"{db_name} not connect success!")

engine = create_engine(
f"mysql+pymysql://"
+ quote(CFG.LOCAL_DB_USER)
+ ":"
+ urlquote(CFG.LOCAL_DB_PASSWORD)
+ "@"
+ CFG.LOCAL_DB_HOST
+ ":"
+ str(CFG.LOCAL_DB_PORT)
+ f"/{db_name}"
f"mysql+pymysql://{quote(CFG.LOCAL_DB_USER)}:{urlquote(CFG.LOCAL_DB_PASSWORD)}@{CFG.LOCAL_DB_HOST}:{str(CFG.LOCAL_DB_PORT)}/{db_name}"
)
else:
engine = create_engine(f"sqlite:///{db_path}")
Expand Down
12 changes: 1 addition & 11 deletions pilot/connections/rdbms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,7 @@ def from_uri_db(
engine_args (Optional[dict]):other engine_args.
"""
db_url: str = (
cls.driver
+ "://"
+ quote(user)
+ ":"
+ urlquote(pwd)
+ "@"
+ host
+ ":"
+ str(port)
+ "/"
+ db_name
f"{cls.driver}://{quote(user)}:{urlquote(pwd)}@{host}:{str(port)}/{db_name}"
)
return cls.from_uri(db_url, engine_args, **kwargs)

Expand Down
12 changes: 1 addition & 11 deletions pilot/connections/rdbms/conn_clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,7 @@ def from_uri_db(
**kwargs: Any,
) -> RDBMSDatabase:
db_url: str = (
cls.driver
+ "://"
+ quote(user)
+ ":"
+ urlquote(pwd)
+ "@"
+ host
+ ":"
+ str(port)
+ "/"
+ db_name
f"{cls.driver}://{quote(user)}:{urlquote(pwd)}@{host}:{str(port)}/{db_name}"
)
return cls.from_uri(db_url, engine_args, **kwargs)

Expand Down
2 changes: 0 additions & 2 deletions pilot/connections/rdbms/conn_duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,3 @@ def table_simple_info(self) -> Iterable[str]:

results.append(f"{table_name}({','.join(table_colums)});")
return results


12 changes: 1 addition & 11 deletions pilot/connections/rdbms/conn_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@ def from_uri_db(
**kwargs: Any,
) -> RDBMSDatabase:
db_url: str = (
cls.driver
+ "://"
+ quote(user)
+ ":"
+ urlquote(pwd)
+ "@"
+ host
+ ":"
+ str(port)
+ "/"
+ db_name
f"{cls.driver}://{quote(user)}:{urlquote(pwd)}@{host}:{str(port)}/{db_name}"
)
return cls.from_uri(db_url, engine_args, **kwargs)

Expand Down

0 comments on commit bc6ca11

Please sign in to comment.