commit
b3cf7d7fbf
BIN
PyMySQL-0.9.2.tar.gz
Normal file
BIN
PyMySQL-0.9.2.tar.gz
Normal file
Binary file not shown.
36
README.en.md
36
README.en.md
@ -1,36 +0,0 @@
|
||||
# python-PyMySQL
|
||||
|
||||
#### Description
|
||||
Pure Python MySQL Client
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
141
README.md
141
README.md
@ -1,37 +1,128 @@
|
||||
# python-PyMySQL
|
||||
PyMySQL
|
||||
=======
|
||||
|
||||
#### 介绍
|
||||
Pure Python MySQL Client
|
||||
.. contents:: Table of Contents
|
||||
:local:
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
This package contains a pure-Python MySQL client library, based on `PEP 249`_.
|
||||
|
||||
Most public APIs are compatible with mysqlclient and MySQLdb.
|
||||
|
||||
NOTE: PyMySQL doesn't support low level APIs `_mysql` provides like `data_seek`,
|
||||
`store_result`, and `use_result`. You should use high level APIs defined in `PEP 249`_.
|
||||
But some APIs like `autocommit` and `ping` are supported because `PEP 249`_ doesn't cover
|
||||
their usecase.
|
||||
|
||||
.. _`PEP 249`: https://www.python.org/dev/peps/pep-0249/
|
||||
|
||||
|
||||
#### 安装教程
|
||||
Requirements
|
||||
-------------
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
* Python -- one of the following:
|
||||
|
||||
#### 使用说明
|
||||
- CPython_ : 2.7 and >= 3.4
|
||||
- PyPy_ : Latest version
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
* MySQL Server -- one of the following:
|
||||
|
||||
#### 参与贡献
|
||||
- MySQL_ >= 5.5
|
||||
- MariaDB_ >= 5.5
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
.. _CPython: https://www.python.org/
|
||||
.. _PyPy: https://pypy.org/
|
||||
.. _MySQL: https://www.mysql.com/
|
||||
.. _MariaDB: https://mariadb.org/
|
||||
|
||||
|
||||
#### 码云特技
|
||||
Installation
|
||||
------------
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
|
||||
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
Package is uploaded on `PyPI <https://pypi.org/project/PyMySQL>`_.
|
||||
|
||||
You can install it with pip::
|
||||
|
||||
$ pip3 install PyMySQL
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Documentation is available online: https://pymysql.readthedocs.io/
|
||||
|
||||
For support, please refer to the `StackOverflow
|
||||
<https://stackoverflow.com/questions/tagged/pymysql>`_.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
The following examples make use of a simple table
|
||||
|
||||
.. code:: sql
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`email` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
`password` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
|
||||
AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
.. code:: python
|
||||
|
||||
import pymysql.cursors
|
||||
|
||||
# Connect to the database
|
||||
connection = pymysql.connect(host='localhost',
|
||||
user='user',
|
||||
password='passwd',
|
||||
db='db',
|
||||
charset='utf8mb4',
|
||||
cursorclass=pymysql.cursors.DictCursor)
|
||||
|
||||
try:
|
||||
with connection.cursor() as cursor:
|
||||
# Create a new record
|
||||
sql = "INSERT INTO `users` (`email`, `password`) VALUES (%s, %s)"
|
||||
cursor.execute(sql, ('webmaster@python.org', 'very-secret'))
|
||||
|
||||
# connection is not autocommit by default. So you must commit to save
|
||||
# your changes.
|
||||
connection.commit()
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
# Read a single record
|
||||
sql = "SELECT `id`, `password` FROM `users` WHERE `email`=%s"
|
||||
cursor.execute(sql, ('webmaster@python.org',))
|
||||
result = cursor.fetchone()
|
||||
print(result)
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
This example will print:
|
||||
|
||||
.. code:: python
|
||||
|
||||
{'password': 'very-secret', 'id': 1}
|
||||
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
* DB-API 2.0: http://www.python.org/dev/peps/pep-0249
|
||||
|
||||
* MySQL Reference Manuals: http://dev.mysql.com/doc/
|
||||
|
||||
* MySQL client/server protocol:
|
||||
http://dev.mysql.com/doc/internals/en/client-server-protocol.html
|
||||
|
||||
* "Connector" channel in MySQL Community Slack:
|
||||
http://lefred.be/mysql-community-on-slack/
|
||||
|
||||
* PyMySQL mailing list: https://groups.google.com/forum/#!forum/pymysql-users
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
PyMySQL is released under the MIT License. See LICENSE for more information.
|
||||
|
||||
67
python-PyMySQL.spec
Normal file
67
python-PyMySQL.spec
Normal file
@ -0,0 +1,67 @@
|
||||
Name: python-PyMySQL
|
||||
Version: 0.9.2
|
||||
Release: 3
|
||||
Summary: Pure Python MySQL Client
|
||||
License: MIT
|
||||
URL: https://pypi.python.org/pypi/PyMySQL/
|
||||
Source0: https://files.pythonhosted.org/packages/source/P/PyMySQL/PyMySQL-%{version}.tar.gz
|
||||
|
||||
BuildRequires: python2-cryptography python2-devel python2-setuptools
|
||||
BuildRequires: python3-cryptography python3-devel python3-setuptools
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
This package contains a pure-Python MySQL client library, based on PEP 249.
|
||||
Most public APIs are compatible with mysqlclient and MySQLdb.
|
||||
|
||||
NOTE: PyMySQL doesn't support low level APIs _mysql provides like data_seek,
|
||||
store_result, and use_result. You should use high level APIs defined in PEP 249.
|
||||
But some APIs like autocommit and ping are supported because PEP 249 doesn't
|
||||
cover their usecase.
|
||||
|
||||
%package -n python2-PyMySQL
|
||||
Summary: Pure Python2 MySQL Client
|
||||
Requires: python2-cryptography
|
||||
%{?python_provide:%python_provide python2-PyMySQL}
|
||||
|
||||
%description -n python2-PyMySQL
|
||||
This package contains a pure-Python MySQL client library, based on PEP 249.
|
||||
Most public APIs are compatible with mysqlclient and MySQLdb.
|
||||
|
||||
%package -n python3-PyMySQL
|
||||
Summary: Pure Python3 MySQL client
|
||||
Requires: python3-cryptography
|
||||
%{?python_provide:%python_provide python3-PyMySQL}
|
||||
|
||||
%description -n python3-PyMySQL
|
||||
This package contains a pure-Python MySQL client library, based on PEP 249.
|
||||
Most public APIs are compatible with mysqlclient and MySQLdb.
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -n PyMySQL-%{version} -p1
|
||||
|
||||
%build
|
||||
%py2_build
|
||||
%py3_build
|
||||
|
||||
%install
|
||||
%py2_install
|
||||
%py3_install
|
||||
|
||||
|
||||
%files -n python2-PyMySQL
|
||||
%doc README.rst
|
||||
%license LICENSE
|
||||
%{python2_sitelib}/*
|
||||
|
||||
%files -n python3-PyMySQL
|
||||
%doc README.rst
|
||||
%license LICENSE
|
||||
%{python3_sitelib}/*
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Feb 14 2020 hy-euler <eulerstoragemt@huawei.com> - 0.9.2-3
|
||||
- Package Initialization
|
||||
Loading…
x
Reference in New Issue
Block a user