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
from pyhive import hive | |
def connect_to_pyhive(): | |
""" Connects to Pyhive with HTTP mode | |
""" | |
conn = hive.connect(thrift_transport=add_http_mode_support()) | |
cursor = conn.cursor() | |
cursor.execute("show databases") | |
print cursor.fetchone() |
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
import json | |
import tornado.web | |
class JsonHandler(BaseHandler): | |
"""Request handler where requests and responses speak JSON.""" | |
def prepare(self): | |
# Incorporate request JSON into arguments dictionary. | |
if self.request.body: | |
try: |
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
class Density(object): | |
def __init__(self, data, bw=None): | |
""" class definitions | |
""" | |
self.maxmin['maxima'] = [] | |
self.maxmin['minima'] = [] | |
def new_values_for_maxmin_validator(method): | |
"""This is the decorator |