This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |