Skip to content

Commit a8847fa

Browse files
authored
FIX support the latest pymysql (#75)
pymysql 0.8 introduced some backward incompatible changes, so let's upgrade the usage here
1 parent 987d715 commit a8847fa

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.8.2
2+
* Support 0.9.x `pymysql` in `sparkly.testing.MysqlFixture`
3+
14
## 2.8.1
25
* Fix support for using multiple sparkly sessions during tests
36
* SparklySession does not persist modifications to os.environ

requirements_docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ pytest-cov==2.3.1
2222
Sphinx==1.4.6
2323
sphinx_rtd_theme==0.1.9
2424
cassandra-driver==3.7.1
25-
PyMySQL==0.7.9
25+
PyMySQL==0.9.3
2626
kafka-python==1.2.2
2727
-e git+https://github.com/Tubular/spark@branch-2.1.0#egg=pyspark&subdirectory=python

requirements_extras.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
cassandra-driver==3.7.1
18-
PyMySQL==0.7.9
18+
PyMySQL==0.9.3
1919
kafka-python==1.2.2
2020
redis==2.10.5
2121
ujson==1.35

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@
9393
extras_require={
9494
'kafka': ['kafka-python>=1.2.2,<1.3'],
9595
'redis': ['redis>=2.10,<3', 'ujson>=1.33,<2'],
96-
'test': ['cassandra-driver>=3.7,<3.8', 'PyMySQL>=0.7,<0.8', 'kafka-python>=1.2.2,<1.3', 'redis>=2.10,<3', 'ujson>=1.33,<2'],
96+
'test': ['cassandra-driver>=3.7,<3.8', 'PyMySQL>=0.7,<0.10', 'kafka-python>=1.2.2,<1.3', 'redis>=2.10,<3', 'ujson>=1.33,<2'],
9797
},
9898
)

sparkly/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
assert SparklySession
2020

2121

22-
__version__ = '2.8.1'
22+
__version__ = '2.8.2'

sparkly/testing.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616

1717
import collections
1818
import contextlib
19-
import copy
2019
import difflib
2120
from functools import partial, total_ordering
2221
import importlib
2322
import json
2423
import logging
2524
import math
26-
import operator
2725
import os
2826
import pprint
29-
import shutil
3027
import signal
3128
import sys
3229
import tempfile
@@ -36,7 +33,6 @@
3633

3734
from pyspark.context import SparkContext
3835
from pyspark.sql import types as T
39-
import six
4036

4137
from sparkly import SparklySession
4238
from sparkly.exceptions import FixtureError
@@ -55,13 +51,10 @@
5551

5652
try:
5753
import pymysql as connector
54+
from pymysql.constants import CLIENT
5855
MYSQL_FIXTURES_SUPPORT = True
5956
except ImportError:
60-
try:
61-
import mysql.connector as connector
62-
MYSQL_FIXTURES_SUPPORT = True
63-
except ImportError:
64-
MYSQL_FIXTURES_SUPPORT = False
57+
MYSQL_FIXTURES_SUPPORT = False
6558

6659
try:
6760
from kafka import KafkaProducer, SimpleClient
@@ -749,6 +742,8 @@ def _execute(self, statements):
749742
password=self.password,
750743
host=self.host,
751744
port=self.port,
745+
program_name='sparkly',
746+
client_flag=CLIENT.MULTI_STATEMENTS,
752747
)
753748
cursor = ctx.cursor()
754749
cursor.execute(statements)

0 commit comments

Comments
 (0)