Skip to content

Commit 0cc98b5

Browse files
committed
Revert "WL#15836: Split mysql and mysqlx into different packages"
This reverts commit b15f9c2.
1 parent b15f9c2 commit 0cc98b5

File tree

200 files changed

+48183
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+48183
-50
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dist/
1919
docs/INFO_BIN
2020
docs/INFO_SRC
2121
lib/mysql/vendor/
22+
src/mysqlxpb/mysqlx/mysqlx*
2223
pip-wheel-metadata/
2324
tests_*.log
2425
venv/

CHANGES.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Full release notes:
1111
v8.2.0
1212
======
1313

14-
- WL#15836: Split mysql and mysqlx into different packages
1514
- WL#15623: Improve the authentication module
1615
- WL#15218: Support WebAuthn authentication
1716
- BUG#35547876: C/Python 8.1.0 type check build fails in the pb2 branch

CONTRIBUTING.rst

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,26 @@ Run the entire test suite:
7777

7878
.. code-block:: bash
7979
80-
shell> python unittests.py --with-mysql=<mysql-dir> --with-mysql-capi=<mysql-capi-dir>
80+
shell> python unittests.py --with-mysql=<mysql-dir> --with-mysql-capi=<mysql-capi-dir> --with-protobuf-include-dir=<protobuf-include-dir> --with-protobuf-lib-dir=<protobuf-lib-dir> --with-protoc=<protoc-binary>
8181
8282
Example:
8383

8484
.. code-block:: sh
8585
86-
shell> python unittests.py --with-mysql=/usr/local/mysql --with-mysql-capi=/usr/local/mysql
86+
shell> python unittests.py --with-mysql=/usr/local/mysql --with-mysql-capi=/usr/local/mysql --with-protobuf-include-dir=/usr/local/protobuf/include --with-protobuf-lib-dir=/usr/local/protobuf/lib --with-protoc=/usr/local/protobuf/bin/protoc
8787
8888
The tests can be configured to be launched using an external server or bootstrapping it. The former is preferred (we'll assume so moving forward).
8989

90-
As you can see, there are several parameters that can be injected into the ``unittests`` module. The parameters shown above are optional, or a must if you want to run the tests with the *C extension* enabled for the ``mysql.connector`` module.
90+
As you can see, there are several parameters that can be injected into the ``unittests`` module. The parameters shown above are optional, or a must if you want to run the tests with the *C extension* enabled for the ``mysql.connector`` and ``mysqlx`` modules.
9191

92-
The ``with-mysql-capi`` flag is needed to build the `C extension` of ``mysql.connector``.
92+
The ``with-mysql-capi`` flag is needed to build the `C extension` of ``mysql.connector``, the remaining ones are needed to build it for ``mysqlx``.
9393

9494
Additionally, there are parameters or flags that can be provided to set values to be used when connecting to the server:
9595

9696
* **user**: the value stored by the environment variable ``MYSQL_USER`` is used (if set), otherwise, ``root`` is used by default.
9797
* **password**: the value of ``MYSQL_PASSWORD`` is used (if set), otherwise, ``empty_string`` is used by default.
9898
* **port**: the value of ``MYSQL_PORT`` is used (if set), otherwise, ``3306`` is used by default.
99+
* **mysqlx-port**: the value of ``MYSQLX_PORT`` is used (if set), otherwise, ``33060`` is used by default.
99100
* **host**: the value of ``MYSQL_HOST`` is used (if set), otherwise, ``127.0.0.1`` (localhost) is used by default.
100101

101102
The previous defaults conform to the standard or default configuration implemented by the MySQL server. Actually, there are many more flags available, you can explore them via ``python unittests.py --help``.
@@ -124,12 +125,19 @@ If you do not provide any flag regarding *control of the unit tests selection*,
124125
- cursor
125126
- errors
126127
- mysql_datatypes
128+
- mysqlx_connection
129+
- mysqlx_crud
130+
- mysqlx_errorcode
131+
- mysqlx_pooling
127132
- network
128133
- optionfiles
129134
- pooling
130135
- protocol
131136
- qa_bug16217743
132137
- qa_caching_sha2_password
138+
- qa_mysqlx_crud_view
139+
- qa_mysqlx_session_reset
140+
- qa_mysqlx_table_column_metadata
133141
- utils
134142

135143
The list is not complete, but you can deduce and find more module names by inspecting the **tests** folder and its subfolders.
@@ -147,6 +155,7 @@ The script uses the environment variables described previously and introduces a
147155
* ``NO_PROXY`` (value of the environment variable in the host by default)
148156
* ``PYPI_REPOSITORY`` (https://pypi.org/pypi by default)
149157
* ``MYSQL_CEXT`` (used to control the building of the **connector.mysql** C-EXT. If set to ``true`` or ``yes``, the extension is built, otherwise it is not)
158+
* ``MYSQLX_CEXT`` (same usage as ``MYSQL_CEXT``, but for the **mysqlx** package)
150159
* ``MYSQL_SOCKET`` (described below)
151160

152161
There is one additional environment variable called ``TEST_PATTERN`` which can be used to provide a string or a regular expression that is applied for filtering one or more matching unit tests to execute.
@@ -163,7 +172,15 @@ If you want to run **connector.mysql** tests related to the C-EXT functionality
163172

164173
$ MYSQL_CEXT='true' TEST_PATTERN='cext.*' MYSQL_PASSWORD='s3cr3t' ./tests/docker/runner.sh
165174

166-
In the examples above, a standard MySQL server configuration is assumed, that's the reason the values for ``MYSQL_HOST``, ``MYSQL_USER`` or ``MYSQL_PORT`` weren't specified.
175+
You can also enable the **mysqlx** C-EXT by injecting a similar parameter::
176+
177+
$ MYSQLX_CEXT='true' TEST_PATTERN='conversion' MYSQL_PASSWORD='s3cr3t' ./tests/docker/runner.sh
178+
179+
Or you can enable the C-EXT for both packages by issuing::
180+
181+
$ MYSQL_CEXT='true' MYSQLX_CEXT='true' TEST_PATTERN='.*er.*' MYSQL_PASSWORD='s3cr3t' ./tests/docker/runner.sh
182+
183+
In the examples above, a standard MySQL server configuration is assumed, that's the reason the values for ``MYSQL_HOST``, ``MYSQL_USER``, ``MYSQL_PORT`` or ``MYSQLX_PORT`` weren't specified.
167184

168185
For **Windows** users, you can set up a suitable environment to run bash scripts by installing `Git Bash <https://git-scm.com/>`_, and using the console it provides instead of the natives *PowerShell* or *CMD*.
169186

@@ -175,20 +192,23 @@ On **macOS** and **Windows**, since containers run on a virtual machine, host lo
175192

176193
Due to some `know limitations <https://github.com/docker/for-mac/issues/483>`_ on the macOS Docker architecture, Unix socket tests can only run on Linux. In that case, if the ``MYSQL_SOCKET`` variable is explicitly specified, a shared volume between the host and the container will be created as a mount point from the socket file path in the host and an internal container directory specified as a volume, where the socket file path becomes available.
177194

178-
That being said, the following are some examples of possible use cases:
195+
That being said, the following there are some examples of possible use cases:
179196

180-
* Running the test modules whose name follows the pattern ``c.*`` from a mac whose IP is ``232.188.98.520``, and the password for ``root`` is ``s3cr3t``. Classic protocol is listening on port ``3306``::
197+
* Running the test modules whose name follows the pattern ``c.*`` from a mac whose IP is ``232.188.98.520``, and the password for ``root`` is ``s3cr3t``. Classic and XDevAPI protocols listening on ports ``3306`` and ``33060`` respectively::
181198

182199
$ TEST_PATTERN='c.*' MYSQL_HOST='192.168.68.111' MYSQL_PASSWORD='s3cr3t' ./tests/docker/runner.sh
183200

184-
* Running the whole test suite from Linux with MySQL user account ``docker``, and password ``s3cr3t``. Classic protocol is listening on port ``3308``::
201+
* Running the whole test suite from Linux with MySQL user account ``docker``, and password ``s3cr3t``. Classic and XDevAPI protocols listening on ports ``3308`` and ``33060`` respectively::
185202

186203
$ MYSQL_PORT='3308' MYSQL_USER='docker' MYSQL_PASSWORD='s3cr3t' ./tests/docker/runner.sh
187204

188205
* Same setup as before but with the **connector.mysql** C-EXT enabled::
189206

190207
$ MYSQL_CEXT='true' MYSQL_PORT='3308' MYSQL_USER='docker' MYSQL_PASSWORD='s3cr3t' ./tests/docker/runner.sh
191208

209+
* Running the *bugs* test module from Linux with MySQL user account ``root``, and password ``empty_string``. Classic and XDevAPI protocols listening on ports ``3306`` and ``33070`` respectively::
210+
211+
$ MYSQLX_PORT='33070' TEST_PATTERN='bugs' ./tests/docker/runner.sh
192212

193213
Test Coverage
194214
-------------

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include MANIFEST.in
1010
recursive-include examples *.py
1111
recursive-include lib *.py
1212
recursive-include tests *.py *.csv *.pem *.cnf
13-
recursive-include src *.c *.h *.cc
13+
recursive-include src *.c *.h *.cc *.proto
1414
recursive-include cpydist *.py
1515

1616
include docs/INFO_SRC

README.rst

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ MySQL Connector/Python
88
.. image:: https://img.shields.io/pypi/l/mysql-connector-python.svg
99
:target: https://pypi.org/project/mysql-connector-python/
1010

11-
MySQL Connector/Python enables Python programs to access MySQL databases, using an API that is compliant with the `Python Database API Specification v2.0 (PEP 249) <https://www.python.org/dev/peps/pep-0249/>`_.
11+
MySQL Connector/Python enables Python programs to access MySQL databases, using an API that is compliant with the `Python Database API Specification v2.0 (PEP 249) <https://www.python.org/dev/peps/pep-0249/>`_. It also contains an implementation of the `X DevAPI <https://dev.mysql.com/doc/x-devapi-userguide/en>`_, an Application Programming Interface for working with the `MySQL Document Store <https://dev.mysql.com/doc/refman/8.0/en/document-store.html>`_.
1212

1313
Installation
1414
------------
@@ -17,10 +17,9 @@ The recommended way to install Connector/Python is via `pip <https://pip.pypa.io
1717

1818
Make sure you have a recent `pip <https://pip.pypa.io/>`_ version installed on your system. If your system already has ``pip`` installed, you might need to update it. Or you can use the `standalone pip installer <https://pip.pypa.io/en/latest/installing/#installing-with-get-pip-py>`_.
1919

20-
Classic connector:
21-
22-
$ pip install mysql-connector-python
20+
.. code-block:: bash
2321
22+
shell> pip install mysql-connector-python
2423
2524
Please refer to the `installation tutorial <https://dev.mysql.com/doc/dev/connector-python/8.0/installation.html>`_ for installation alternatives.
2625

@@ -53,8 +52,38 @@ Using the MySQL classic protocol:
5352
# Close connection
5453
cnx.close()
5554
55+
Using the MySQL X DevAPI:
56+
57+
.. code:: python
58+
59+
import mysqlx
60+
61+
# Connect to server
62+
session = mysqlx.get_session(
63+
host="127.0.0.1",
64+
port=33060,
65+
user="mike",
66+
password="s3cr3t!")
67+
schema = session.get_schema("test")
68+
69+
# Use the collection "my_collection"
70+
collection = schema.get_collection("my_collection")
71+
72+
# Specify which document to find with Collection.find()
73+
result = collection.find("name like :param") \
74+
.bind("param", "S%") \
75+
.limit(1) \
76+
.execute()
77+
78+
# Print document
79+
docs = result.fetch_all()
80+
print(r"Name: {0}".format(docs[0]["name"]))
81+
82+
# Close session
83+
session.close()
84+
5685
57-
Please refer to the `MySQL Connector/Python Developer Guide <https://dev.mysql.com/doc/connector-python/en/>`_ for a complete usage guide.
86+
Please refer to the `MySQL Connector/Python Developer Guide <https://dev.mysql.com/doc/connector-python/en/>`_ and the `MySQL Connector/Python X DevAPI Reference <https://dev.mysql.com/doc/dev/connector-python/>`_ for a complete usage guide.
5887

5988
Additional Resources
6089
--------------------

0 commit comments

Comments
 (0)