Skip to content

Instantly share code, notes, and snippets.

View randyzwitch's full-sized avatar

Randy Zwitch randyzwitch

View GitHub Profile
@randyzwitch
randyzwitch / 201801_loadingfailure.sh
Created November 6, 2019 21:29
Failure to load any records in OmniSci
omnisql> copy baywheels_tripdata from 's3://baywheels-data/201801-fordgobike-tripdata.csv.zip';
Result
Loaded: 0 recs, Rejected: 94802 recs in 5.752000 secs
@randyzwitch
randyzwitch / 2017_baywheels_omnisci.sql
Created November 6, 2019 21:20
2017 FordGoBike/Baywheels data in OmniSci
--define table for 2017 schema
CREATE TABLE baywheels_tripdata(
duration_sec INTEGER,
start_time TIMESTAMP,
end_time TIMESTAMP,
start_station_id SMALLINT,
start_station_name TEXT ENCODING DICT,
start_station_latitude FLOAT,
start_station_longitude FLOAT,
end_station_id SMALLINT,
@randyzwitch
randyzwitch / customers_nopii.sh
Last active September 25, 2019 13:03
Limited Select Statement SQL Server to OmnISci
#run in OmniSci before import to define table
create table customers_nopii(
customerid TEXT ENCODING DICT,
service_address TEXT ENCODING DICT,
address_geom POLYGON
)
#export custom query to OmniSci
java -cp /opt/omnisci/bin/mapd-1.0-SNAPSHOT-jar-with-dependencies.jar:/path/mssql-jdbc-7.4.1.jre8.jar \
com.mapd.utility.SQLImporter \
@randyzwitch
randyzwitch / sqlserver-to-omnisci.sh
Last active September 24, 2019 20:17
Example SQL Server to OmniSci SQLImporter code
java -cp /opt/omnisci/bin/mapd-1.0-SNAPSHOT-jar-with-dependencies.jar:/path/mssql-jdbc-7.4.1.jre8.jar \
com.mapd.utility.SQLImporter \
-d com.microsoft.sqlserver.jdbc.SQLServerDriver \
-u admin -p HyperInteractive -db omnisci --port 6274 -t customers \
-su sqlserver_user -sp sqlserver_password \
-c "jdbc:sqlserver://localhost:1433;DatabaseName=prod" \
-ss "select * from dbo.customers"
@randyzwitch
randyzwitch / java-version.sh
Created September 24, 2019 19:54
Checking Java version
$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
@randyzwitch
randyzwitch / servers-colorbrewer-sequential.json
Created August 23, 2019 19:41
OmniSci Immerse servers.json with ColorBrewer sequential scales
[
{
"customStyles": {
"colors": {
"solid": [
"#ea5545",
"#f46a9b",
"#ef9b20",
"#ede15b",
"#bdcf32",
@randyzwitch
randyzwitch / geo_types.jl
Created July 26, 2019 19:11
OmniSci.jl Geo query
julia> geodf = sql_execute(conn, "select * from omnisci_states")
52×4 DataFrame. Omitted printing of 1 columns
│ Row │ id │ abbr │ name │
│ │ String⍰ │ String⍰ │ String⍰ │
├─────┼─────────┼─────────┼──────────────────────┤
101 │ AL │ Alabama │
202 │ AK │ Alaska │
304 │ AZ │ Arizona │
405 │ AR │ Arkansas │
511 │ DC │ District of Columbia │
@randyzwitch
randyzwitch / omnisci_getting_started.jl
Last active July 26, 2019 20:17
Example OmniSci.jl query
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.1.0 (2019-01-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using OmniSci, DataFrames
@randyzwitch
randyzwitch / omniscidb-centos7-gpu.sh
Created June 19, 2019 13:27
Compiling OmniSciDB for CentOS 7 with GPU support
# run image interactively
docker run -it --runtime=nvidia --rm nvidia/cuda:10.0-devel-centos7 bash
# update image
yum update -y && yum install git sudo -y
# clone project and download/install dependencies
git clone https://github.com/omnisci/omniscidb.git
bash /omniscidb/scripts/mapd-deps-prebuilt.sh
@randyzwitch
randyzwitch / peloton_script.py
Last active June 20, 2019 18:16
Peloton bulk download script
import requests
import pandas as pd
user = "user"
password = "password"
# authenticate to get user_id and session_id
authcall = requests.post("https://api.pelotoncycle.com/auth/login",
json = {"username_or_email": user, "password": password})