Skip to content
Jing Wang edited this page Sep 9, 2017 · 13 revisions

This is dump of development notes.

Releasing

Remove dev from setup.cfg's tag_build

python setup.py sdist
gpg --detach-sign --armor *.tar.gz
twine upload PyHive*

Local testing

Start with http://releases.ubuntu.com/14.04/

echo Etc/UTC | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get install -y git openssh-server python-pip
sudo pip install virtualenv wheel

virtualenv --no-site-packages ~/env
source ~/env/bin/activate

git clone https://github.com/dropbox/PyHive.git
cd PyHive
CDH=cdh5 CDH_VERSION=5 PRESTO=RELEASE SQLALCHEMY=sqlalchemy scripts/travis-install.sh

py.test -v

Authentication

https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-Authentication/SecurityConfiguration

LDAP

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-a-basic-ldap-server-on-an-ubuntu-12-04-vps

sudo apt-get install sldap ldap-utils phpldapadmin

Edit /etc/hive/conf/hive-site.xml

<property>
  <name>hive.server2.authentication</name>
  <value>LDAP</value>
</property>
<property>
  <name>hive.server2.authentication.ldap.url</name>
  <value>ldap://localhost:389</value>
</property>

Restart HiveServer2:

sudo service hive-server2 restart

Test:

from pyhive.hive import *
from thrift.transport.TTransport import *

c = connect('localhost', username='cn=admin,dc=test,dc=com', password='a')
cur = c.cursor()
cur.execute('show tables')
print(cur.fetchall())

# should fail
try:
    connect('localhost', username='cn=admin,dc=test,dc=com', password='ab')
    assert False
except TTransportException as e:
    assert 'Error validating the login' in e.message
    print(e)
Clone this wiki locally