Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
Fixed bug when returning empty resultset as DataFrame
  • Loading branch information
JamieTaylor-TUOS committed Jan 11, 2021
1 parent 2f608e7 commit 0eb23b0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A wrapper for the MySQL Python connector that provides additional resilience an

* A wrapper for the MySQL Python connector that provides additional resilience and functionality.
* Implements connection pooling that's more reliable.
* Version 1.2.0
* Version 1.2.1
* Works with Python 2.7+ or 3.5+

## How do I get set up? ##
Expand Down
5 changes: 1 addition & 4 deletions dbconnector/dbconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,7 @@ def _select_query(cnx, **kwargs):
col_regex = "(?<=^select)[a-zA-Z0-9_\s*(),`]+(?=from)"
cols = [c.strip().split(" as ")[-1].strip().strip("`") for c in
re.findall(col_regex, sqlquery.lower())[0].strip().split(",")]
if result[0]:
return DataFrame(result, columns=cols)
else:
return DataFrame({c: [] for c in cols})
return DataFrame(result, columns=cols)
return result

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version="1.2.0",
version="1.2.1",

description="A wrapper for the MySQL Python connector that provides additional resilience and functionality.",
long_description=long_description,
Expand Down Expand Up @@ -60,10 +60,10 @@
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],

# What does your project relate to?
Expand Down

0 comments on commit 0eb23b0

Please sign in to comment.