forked from dropbox/PyHive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add JWT support to PyHive (#1)
* feat: add HTTP and HTTPS to hive (dropbox#385) * feat: add https protocol * support HTTP * fix: make hive https py2 compat (dropbox#389) * fix: make hive https py2 compat * fix lint * Update README.rst (dropbox#423) * chore: rename Trino entry point (dropbox#428) * Support for Presto decimals (dropbox#430) * Support for Presto decimals * lower * Use str type for driver and name in HiveDialect (dropbox#450) PyHive's HiveDialect usage of bytes for the name and driver fields is not the norm is causing issues upstream: apache/superset#22316 Even other dialects within PyHive use strings. SQLAlchemy does not strictly require a string, but all the stock dialects return a string, so I figure it is heavily implied. I think the risk of breaking something upstream with this change is low (but it is there ofc). I figure in most cases we just make someone's `str(dialect.driver)` expression redundant. Examples for some of the other stock sqlalchemy dialects (name and driver fields using str): https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/sqlite/pysqlite.py#L501 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/sqlite/base.py#L1891 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/mysql/base.py#L2383 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/mysql/mysqldb.py#L113 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/mysql/pymysql.py#L59 * Correcting Iterable import for python 3.10 (dropbox#451) * changing drivers to support hive, presto and trino with sqlalchemy>=2.0 (dropbox#448) * Revert "changing drivers to support hive, presto and trino with sqlalchemy>=2.0 (dropbox#448)" (dropbox#452) This reverts commit b0206d3. * Update __init__.py (dropbox#453) dropbox@1c1da8b dropbox@1f99552 * use pure-sasl with python 3.11 (dropbox#454) * minimal changes for sqlalchemy 2.0 support (dropbox#457) * update readme to reflect recent changes (dropbox#459) * Update README.rst (dropbox#475) * Update README.rst (dropbox#476) * feat: JWT support * Add CI to build package --------- Co-authored-by: Daniel Vaz Gaspar <danielvazgaspar@gmail.com> Co-authored-by: Bogdan <b.kyryliuk@gmail.com> Co-authored-by: serenajiang <serena.jiang@airbnb.com> Co-authored-by: Usiel Riedl <usiel.riedl@gmail.com> Co-authored-by: Multazim Deshmukh <57723564+mdeshmu@users.noreply.github.com> Co-authored-by: nicholas-miles <nicholas.miles6@gmail.com>
- Loading branch information
1 parent
d6e7140
commit 32ee963
Showing
23 changed files
with
1,366 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ cover/ | |
.cache/ | ||
*.iml | ||
/scripts/.thrift_gen | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
0.7.0a | ||
====== | ||
|
||
- Add support for JWT authentication. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
LIB_NAME = 'PyHive' | ||
String currentVersion = "" | ||
|
||
|
||
podTemplate( | ||
imagePullSecrets: ['preset-pull'], | ||
nodeUsageMode: 'NORMAL', | ||
containers: [ | ||
containerTemplate( | ||
alwaysPullImage: true, | ||
name: 'ci', | ||
image: 'preset/ci:latest', | ||
ttyEnabled: true, | ||
command: 'cat', | ||
resourceRequestCpu: '100m', | ||
resourceLimitCpu: '200m', | ||
resourceRequestMemory: '1000Mi', | ||
resourceLimitMemory: '2000Mi', | ||
), | ||
containerTemplate( | ||
alwaysPullImage: true, | ||
name: 'py-ci', | ||
image: 'preset/python:3.8.9-ci', | ||
ttyEnabled: true, | ||
command: 'cat' | ||
) | ||
] | ||
) { | ||
node(POD_LABEL) { | ||
container('py-ci') { | ||
stage('Checkout') { | ||
checkout scm | ||
} | ||
|
||
stage('Tests') { | ||
sh(script: 'pip install -e . && pip install -r requirements-dev.txt', label: 'install dependencies') | ||
parallel( | ||
check: { | ||
currentVersion = sh( | ||
script: "python setup.py --version", | ||
returnStdout: true, | ||
label: 'Get current version' | ||
).trim() | ||
def retVal = sh( | ||
script: "curl -I -f https://pypi.devops.preset.zone/${LIB_NAME}/${LIB_NAME}-${currentVersion}.tar.gz", | ||
returnStatus: true, | ||
label: 'Check for existing tarball' | ||
) | ||
// If the thing exists, we should bail as we don't want to overwrite | ||
if (retVal == 0) { | ||
error("Version ${currentVersion} of ${LIB_NAME} already exists! Version bump required.") | ||
} | ||
} | ||
) | ||
} | ||
} | ||
|
||
container('py-ci') { | ||
stage('Package Release') { | ||
if (env.BRANCH_NAME.startsWith("PR-")) { | ||
def shortGitRev = sh( | ||
returnStdout: true, | ||
script: 'git rev-parse --short HEAD' | ||
).trim() | ||
def pullRequestVersion = "${currentVersion}+${env.BRANCH_NAME}.${shortGitRev}" | ||
sh(script:"sed -i \'s/version = ${currentVersion}/version = ${pullRequestVersion}/g\' setup.cfg", label: 'Changing version for PR') | ||
sh(script:"echo PR version: ${pullRequestVersion}", label: 'PR Release candidate version') | ||
} | ||
sh(script: 'python setup.py sdist --formats=gztar', label: 'Bundling release') | ||
sh(script: "mkdir -p dist/${LIB_NAME} && mv dist/*.gz dist/${LIB_NAME}", label: 'Setup release folder') | ||
} | ||
} | ||
|
||
container('ci') { | ||
stage('Upload Release') { | ||
withCredentials([ | ||
[ | ||
$class : 'AmazonWebServicesCredentialsBinding', | ||
credentialsId : 'ci-user', | ||
accessKeyVariable: 'AWS_ACCESS_KEY_ID', | ||
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY', | ||
] | ||
]) { | ||
if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME.startsWith("PR-"))) { | ||
sh(script: "aws s3 sync ./dist s3://preset-pypi", label: "Uploading to s3") | ||
} | ||
else { | ||
echo "Skipping upload as this isn't master..." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from __future__ import absolute_import | ||
from __future__ import unicode_literals | ||
__version__ = '0.6.3' | ||
__version__ = '0.7.0a' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.