Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Created June 24, 2014 00:57
Show Gist options
  • Save randyzwitch/2ecd9f4d67137bc459ed to your computer and use it in GitHub Desktop.
Save randyzwitch/2ecd9f4d67137bc459ed to your computer and use it in GitHub Desktop.
Aster Julia
#Connect to Aster (pre-defined Windows DSN in ODBC Manager)
asterconn = ODBC.connect("aster01"; usr="your-user-name", pwd="your-password")
#Create table to hold airline results
create_airline_table_statement =
"create table ebi_temp.airline
(origin varchar,
flight_takeoff_datetime_origin timestamp,
flight_landing_datetime_origin timestamp,
actualelapsedtime int,
partition key (origin))"
#Execute query
query(create_airline_table_statement, asterconn)
#Create airport table
#Data downloaded from http://openflights.org/data.html
create_airport_table_statement =
"create table ebi_temp.airport
(airport_id int,
name varchar,
city varchar,
country varchar,
IATAFAA varchar,
ICAO varchar,
latitude float,
longitude float,
altitude int,
timezone float,
dst varchar,
partition key (country))"
#Execute query
query(create_airport_table_statement, asterconn)
#Upload data via run() command
#ncluster_loader utility already on Windows PATH
run(`ncluster_loader -h 192.168.1.1 -U your-user-name -w your-password -d aster01 -c --skip-rows=1 --el-enabled --el-table e_dist_error_2 --el-schema temp temp.airline C:\\airline_times.csv`)
run(`ncluster_loader -h 192.168.1.1 -U your-user-name -w your-password -d aster01 -c --el-enabled --el-table e_dist_error_2 --el-schema temp temp.airport C:\\airports.dat`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment