Skip to content

Instantly share code, notes, and snippets.

%sql
CREATE TABLE test
USING org.apache.spark.sql.jdbc
OPTIONS (
url "jdbc:dremio:direct=<host>:31010",
dbtable "postgres.public.actor",
user "",
password "",
driver "com.dremio.jdbc.Driver"
)
# https://community.openvpn.net/openvpn/wiki/OpenVPN3Linux?__cf_chl_jschl_tk__=d2179faf5fb96a597b82601e44f95ad0f2d99541-1613076924-0-AXswPc_bnMJfTp0DEHLhYOdCnX1hf5gnR1QQoWqE9Y_UZqFDIcBEbwTTk4n8SByO_c0_ViL_Lt5wTPWR61N-2AkStgI3YT2QnSAZocktkPSVi-t1E_w0JMT5m7jq1NUliLTrMH0IgbFb5KqH2gcsIrHVsBi7-VKDWhF-w5rQM5MqmeLZ3u_FSdcvn_Dzn0Ac1Cbl9MEghMDrmkTJn61kJxZMtWOxM7GAFS1Y5mjQnizZp0jk9XZ2l6b-OyF_Zcle3FglvJ8FUgetnjxGkjtUk4tAmGF7-xXd6_BYNtB0N9BnNJbswo2Y9YtybHT7QJWZgR_vQ695ErTyqXYUQmg2WtY
# Ubuntu 20.10
apt install apt-transport-https
wget https://swupdate.openvpn.net/repos/openvpn-repo-pkg-key.pub
apt-key add openvpn-repo-pkg-key.pub
wget -O /etc/apt/sources.list.d/openvpn3.list https://swupdate.openvpn.net/community/openvpn3/repos/openvpn3-groovy.list
apt update
apt install openvpn3
'''
The following script is intended to provide examples to use Dremio's REST API.
Please refer to the documentation for more information: https://docs.dremio.com/rest-api/
Required library: requests
Python version: 3.7.2
'''
import requests, time
#Install hive:
export HIVE_HOME=/opt/homebrew/Cellar/hive/apache-hive-3.1.2-bin
wget https://dlcdn.apache.org/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz
mkdir -p /opt/homebrew/Cellar/hive && tar xvf apache-hive-3.1.2-bin.tar.gz -C /opt/homebrew/Cellar/hive
#hive-site.xml
<?xml version="1.0"?>
<configuration>
<property>
username = "dremio"
password = "dremio123"
sqlquery = '''SELECT * FROM Business.Transportation."NYC Trips" limit 10000'''
hostname = "localhost"
flightport = 32010
from pyarrow import flight
class DremioClientAuthMiddlewareFactory(flight.ClientMiddlewareFactory):
def __init__(self):
@naren-dremio
naren-dremio / dremio_flight.py
Last active May 19, 2023 00:15
for dremio cloud
import certifi
import sys
from http.cookies import SimpleCookie
from pyarrow import flight
class DremioClientAuthMiddlewareFactory(flight.ClientMiddlewareFactory):
"""A factory that creates DremioClientAuthMiddleware(s)."""
username = "dremio"
password = "+dremio123"
sqlquery = '''SELECT * from sys.options limit 10'''
hostname = "localhost"
flightport = 32010
from pyarrow import flight
class DremioClientAuthMiddlewareFactory(flight.ClientMiddlewareFactory):
def __init__(self):