Skip to content

Commit 8ed8760

Browse files
committed
BUG: pandas-dev#10652 google-api-python-client minimum version check
1 parent ed13da0 commit 8ed8760

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/io/gbq.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime
2+
import re
23
import json
34
import logging
45
import sys
@@ -25,8 +26,10 @@ def _check_google_client_version():
2526
raise ImportError('Could not import pkg_resources (setuptools).')
2627

2728
_GOOGLE_API_CLIENT_VERSION = pkg_resources.get_distribution('google-api-python-client').version
29+
_GOOGLE_API_CLIENT_VERSION = re.sub(
30+
r'(\.0+)*$', '', _GOOGLE_API_CLIENT_VERSION)
2831

29-
if LooseVersion(_GOOGLE_API_CLIENT_VERSION) < '1.2.0':
32+
if LooseVersion(_GOOGLE_API_CLIENT_VERSION) < '1.2':
3033
raise ImportError("pandas requires google-api-python-client >= 1.2.0 for Google "
3134
"BigQuery support, current version " + _GOOGLE_API_CLIENT_VERSION)
3235

@@ -121,7 +124,7 @@ def get_service(self, credentials):
121124

122125
try:
123126
from apiclient.discovery import build
124-
127+
125128
except ImportError:
126129
raise ImportError('Could not import Google API Client.')
127130

0 commit comments

Comments
 (0)