-
Notifications
You must be signed in to change notification settings - Fork 25
Just some basic fixes I did just to run queries on both ODBC and REST #96
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,5 @@ odbc: | |
| port: 31010 | ||
| flight: | ||
| port: 47470 | ||
| rest: | ||
| port: 7183 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,17 +65,24 @@ def __init__(self, config): | |
| ) | ||
| self._flight_port = config["flight"]["port"].get(int) | ||
| self._odbc_port = config["odbc"]["port"].get(int) | ||
| self._rest_port = config["rest"]["port"].get(int) | ||
|
|
||
| self._username = config["auth"]["username"].get() | ||
| self._password = config["auth"]["password"].get() | ||
| self._token = auth(self._base_url, config) | ||
| self._rest_url = ( | ||
| ("https" if config["ssl"].get(bool) else "http") | ||
| + "://" | ||
| + self._hostname | ||
| + (":{}".format(self._rest_port) if port else "") | ||
| ) | ||
| self._token = auth(self._rest_url, config) | ||
| self._ssl_verify = config["verify"].get(bool) | ||
| self._catalog = catalog(self._token, self._base_url, self.query, self._ssl_verify) | ||
| self._catalog = catalog(self._token, self._rest_url, self.query, self._ssl_verify) | ||
| self._reflections = list() | ||
| self._wlm_queues = list() | ||
| self._wlm_rules = list() | ||
| self._votes = list() | ||
| self._simple = SimpleClient(config) | ||
| #self._simple = SimpleClient(config) # took this off because I didn't know how it was intended to be used for now or in the future | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please leave this. Its a passthrough to get to the lower level api. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @3runkenzie was this still working in your tests without this removed?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I realized that, but I removed it because if I left it there, I couldn't get it to work. |
||
|
|
||
| def simple(self): | ||
| return self._simple | ||
|
|
@@ -132,6 +139,7 @@ def query(self, sql, pandas=True, method="flight"): | |
| return query( | ||
| self._token, | ||
| self._base_url, | ||
| self._rest_url, | ||
| self._hostname, | ||
| self._odbc_port, | ||
| self._flight_port, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
|
|
||
|
|
||
| _WINDOWS_DRIVER = "Dremio Connector" | ||
| _OSX_DRIVER = "Dremio ODBC Driver" | ||
| _OSX_DRIVER = "/Library/Dremio/ODBC/lib/libdrillodbc_sbu.dylib" # had to add this for the driver path | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if this is not changed? I thought the purpose of this was to fix #66 so that odbc worked w/o having to give absolute paths? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rymurr the driver can not be found if this is not changed
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. You are right. I was doing that on my end because |
||
| _LINUX32_DRIVER = "Dremio ODBC Driver 32-bit" | ||
| _LINUX64_DRIVER = "Dremio ODBC Driver 64-bit" | ||
| _DRIVER = None | ||
|
|
@@ -41,9 +41,9 @@ def _get_driver_name(): | |
| _DRIVER = _LINUX64_DRIVER | ||
| else: | ||
| _DRIVER = _LINUX32_DRIVER | ||
| if "darwin" in sys.platform: | ||
| elif "darwin" in sys.platform: # lines 44 and 46 were not mutually exclusive so decided to change | ||
| _DRIVER = _OSX_DRIVER | ||
| if "win" in sys.platform: | ||
| elif "win" in sys.platform: | ||
| _DRIVER = _WINDOWS_DRIVER | ||
| logging.debug("Using %s as the odbc driver", _DRIVER) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ | |
| def query( | ||
| token, | ||
| base_url, | ||
| rest_url, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I wanted to keep the parameters you had there initially (hence self._rest_url = (
("https" if config["ssl"].get(bool) else "http")
+ "://"
+ self._hostname
+ (":{}".format(self._rest_port) if port else "")
)
self._base_url = (
("https" if config["ssl"].get(bool) else "http")
+ "://"
+ self._hostname
+ (":{}".format(port) if port else "")
)
since the ports are different for ODBC vs REST. |
||
| hostname, | ||
| odbc_port, | ||
| flight_port, | ||
|
|
@@ -64,7 +65,7 @@ def query( | |
| return _odbc_query(sql, hostname=hostname, port=odbc_port, username=username, password=password) | ||
| except Exception: | ||
| logging.warning("Unable to run query as odbc, downgrading to rest") | ||
| results = _rest_query(token, base_url, sql, ssl_verify=ssl_verify) | ||
| results = _rest_query(token, rest_url, sql, ssl_verify=ssl_verify) | ||
| if pandas and not NO_PANDAS: | ||
| return pd.DataFrame(results) | ||
| return list(results) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be 9047 as a default