- SQLAlchemy - Core
- SQLAlchemy - ORM
- Paramiko 介紹和操作
- 上下文操作应用
- 初探堡垒机
SQLAlchemy - Core
连接 URL
通过 create_engine 方法创建 MySQL 数据库的连接,create_engine("url") 接受一个 URL 连接:
>>> MySQL-Python: mysql+mysqldb://<user>:<password>@<host>[:<port>]/<dbname>
>>> pymysql: mysql+pymysql://<username>:<password>@<host>/<dbname>[?<options>]
>>> MySQL-Connector: mysql+mysqlconnector://<user>:<password>@<host>[:<port>]/<dbname>
>>> cx_Oracle: oracle+cx_oracle://user:pass@host:port/dbname[?key=value&key=value...]
>>> PostgreSQL: postgresql+pg8000://<user>:<password>@<host>/<db>
Details: http://docs.sqlalchemy.org/en/latest/dialects/index.html