/
Python - Read files from Drill
Python - Read files from Drill
Gist Page : example-python-read-from-drill
Common part
Libraries dependency
pip install pydrill
from pydrill.client import PyDrill
DRILL REST API
Each Drillbit IP is working
Default drillbit is nn1
Default port is 31000
Connection
# Connecting to drill by providing a drillbit ip and the drill rest api port (31000 by default) conn = PyDrill(host=os.environ['IP_DRILLBIT'], port=os.environ['DRILL_API_PORT'])
How to read a file from drill with Python ?
Code example
# The file employee.json is installed with drill as an example sample query = conn.query('SELECT * FROM cp.`employee.json` LIMIT 20', timeout=60) # Create a pandas DataFrame with the result of the query df = query.to_dataframe()
Related content
Java - Read & Write tables from Drill
Java - Read & Write tables from Drill
More like this
Talend - Query from Drill
Talend - Query from Drill
More like this
R - Query from Drill
R - Query from Drill
More like this
Python - Read & Write files from HDFS
Python - Read & Write files from HDFS
More like this
Python - Read & Write files from Hive with Security
Python - Read & Write files from Hive with Security
More like this
Python - Read & Write files from Impala
Python - Read & Write files from Impala
More like this