Skip to content

Instantly share code, notes, and snippets.

View Jammink2's full-sized avatar

John Hammink Jammink2

View GitHub Profile
@Jammink2
Jammink2 / cp_trasactions.sql
Created February 6, 2017 20:24
For Splice Machine Tutorial Video: Using Command Prompts for Transactions
-- This is actually a tutorial about keeping the thing open in multiple sessions
-- in it, we open two consoles and try commands across each one
--first console
autocommit off;
create schema CP;
set schema CP;
@Jammink2
Jammink2 / cleanup_script.sql
Created February 6, 2017 07:43
For Splice Machine Tutorial Video – Creating scripts to run SQL commands
-- cleaning up after scripts created;
-- to run from splice prompt:
-- be sure you set the schema to SCRIPT
-- splice> set schema SCRIPT;
-- splice> run '/<Path>/<to>/<scripts>/cleanup_scripts.sql';
drop table DOMAIN_DATA;
drop schema SCRIPT RESTRICT;
@Jammink2
Jammink2 / scripts.sql
Created February 6, 2017 07:40
For Splice Machine Tutorial Video – Creating scripts to run SQL commands
-- to run this script from splice prompt:
-- splice> run '/<path>/<to>/<script>/scripts.sql';
-- run by
-- $ nohup ./bin/sqlshell.sh < '/<path>/<to>/<script>/scripts.sql' > select-demo.out 2>&1 &
-- or, using -f as file spec
-- nohup ./bin/sqlshell.sh -f '/<path>/<to>/<script>/scripts.sql' > sql-file.out 2>&1 &
-- this script sets the current schema, switches elapsed time on (for time benchmarking) and selects all from DOMAIN_DATA table
@Jammink2
Jammink2 / setup_scripts.sql
Created February 6, 2017 07:33
For Splice Machine Tutorial Video – Creating scripts to run SQL commands
--to run this script from splice prompt:
-- splice> run '/<path>/<to>/<script>/setup_scripts.sql';
--create schema
create schema script;
-- set schema
set schema script;
--create table
@Jammink2
Jammink2 / sql-eof.sh
Created February 6, 2017 07:21
For Splice Machine Tutorial Video – Creating scripts to run SQL commands
#!/usr/bin/bash
echo "Importing into Splice..."
sqlshell.sh << EOF
set schema script;
select * from DOMAIN_DATA;
select count(1) from DOMAIN_DATA;
exit;
EOF
#setting up your vm:
vagrant init hashicorp/precise64
add the following to your Vagrantfile (comment this out at first)
#config.ssh.username = 'root'
#config.ssh.password = 'vagrant'
#config.ssh.insert_key = 'true'
vagrant up
#change sudo root password on your virtual box to 'vagrant'
sudo passwd root
NOTE: These are possibly the worst setup instructions I have ever read. Never EVER send your community across Oracle's shit site to go looking for things. You do NOT EVER dump people on Oracle's page to hopefully find the right SDK. Same thing goes for amazon's poor and convoluted documentation. You give them end to end instructions for setup, tell them EXACTLY what binaries to download (list the most common platform)Otherwise, NOBODY will - nor should - spend their precious time trying to your solution.
Unfortunately, the documentation is too non-specific -
Install Java JDK For MacOS
Follow the MacOS Java JDK installation instructions on the Oracle web site.
#after installing JDK; before starting splice
sudo nano ~/.bash_profile
@Jammink2
Jammink2 / loadall.sql
Last active February 3, 2017 05:55
loadall.sql (from Splice onboarding)
-- the basic 'loadall.sql' from Splice Machine onboarding. I may rework this.
CREATE TABLE T_HEADER
(
TRANSACTION_HEADER_KEY BIGINT NOT NULL,
CUSTOMER_MASTER_ID BIGINT,
TRANSACTION_DT DATE NOT NULL,
STORE_NBR SMALLINT NOT NULL,
EXCHANGE_RATE_PERCENT DOUBLE PRECISION,
GEOCAPTURE_FLG VARCHAR(1),
-- a short file to demo basic ddl loading functions in Splice Machine
--create schema
create schema DDL;
--set schema
set schema DDL;
--check current schema
values(current schema);
SELECT SUM(c) AS total_subscribers, COUNT(email) AS distinct_subscribers FROM (SELECT email, COUNT(1) as c FROM email) tbl -- Get two columns, one total, another # of distinct email addresses