Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/sqlalchemy/example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python3
from urllib.parse import quote_plus
from sqlalchemy import create_engine, Column, Integer, VARCHAR
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
Expand All @@ -12,7 +13,7 @@

# 创建一个 SQLAlchemy 引擎,连接到 OceanBase 数据库
# 创建数据库连接字符串
connection_string = f'mysql+pymysql://{username}:{password}@{host}:{port}/{database}'
connection_string = f'mysql+pymysql://{username}:{quote_plus(password)}@{host}:{port}/{database}'
# 创建SQLAlchemy引擎
engine = create_engine(connection_string)

Expand Down
Loading