-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom requests session in presto connections #106
Support custom requests session in presto connections #106
Conversation
omniduct/databases/presto.py
Outdated
""" | ||
catalog (str): The default catalog to use in database queries. | ||
schema (str): The default schema/database to use in database queries. | ||
server_protocol (str): The protocol over which to connect to the Presto REST | ||
service ('http' or 'https'). (default='http') | ||
source (str): The source of this query (by default "omniduct <version>"). | ||
If manually specified, result will be: "<source> / omniduct <version>". | ||
requests_session (requests.Session): an optional ``requests.Session`` object for advanced usage. |
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.
nit: single backticks here on requests.Session
omniduct/databases/presto.py
Outdated
""" | ||
self.catalog = catalog | ||
self.schema = schema | ||
self.server_protocol = server_protocol | ||
self.source = source | ||
self.__presto = None | ||
self.connection_fields += ('catalog', 'schema') | ||
self.requests_session = requests_session |
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.
likely we should have the be private (ie. start with an underscore)
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.
Hey @gthomas-slack - thanks for this and for contributing to omniduct! A couple nits but nothing significant. I'll let @matthewwardrop comment as well.
Thanks @danfrankj ! I've pushed a commit to address those nits |
Hi @gthomas-slack ! Thanks for the patch! Merging it in now! [I'll put out a new release soon]. FYI: Eventually, I had planned to migrate |
Thanks @matthewwardrop ! Ah interesting - if/when it comes time to fully switchover to |
pyhive
supports passing through a custom requests session for advanced usage such as custom headers, cookie values, retry logic, etc - https://github.com/dropbox/PyHive/blob/master/pyhive/presto.py#L115This PR adds support for passing through a custom requests session to
pyhive
when creating anomniduct
PrestoClient
.