Skip to content

Instantly share code, notes, and snippets.

View gilfernandes's full-sized avatar

Gil Fernandes gilfernandes

  • Onepoint Consulting Ltd
  • London
View GitHub Profile
@gilfernandes
gilfernandes / anim_barchart.py
Created May 18, 2020 18:27
Covid 19 barchart animation code
import matplotlib.style as style
plt.rcParams.update({'font.size': 16})
plt.rc('axes', titlesize=16) # fontsize of the axes title
plt.rc('axes', labelsize=16) # fontsize of the x and y labels
plt.rc('xtick', labelsize=16)
plt.rc('ytick', labelsize=16)
unique_dates = df_grouped[date].unique()
days_in_dataset = len(unique_dates)
@gilfernandes
gilfernandes / anim_fig.py
Created May 18, 2020 18:15
Animation Figure Definition
%%capture
fig, ax = plt.subplots(figsize = (15, 11))
use admin
db.createUser( { user: "admin",
pwd: "************",
roles: [ "userAdminAnyDatabase",
"dbAdminAnyDatabase",
"readWriteAnyDatabase"
] } )
use dqdict
# This file contains the commands I use to build the latestTalend Open Source version
# Create a directory where the whole GIT files are to be downloaded
# The best way to download the Talend source files as of writing this Gist is to go to URL: https://github.com/Talend/studio-se-master
# and follow the instructions there.
# Make sure you have already downloaded and installed Maven from https://maven.apache.org/download.cgi, also gits.
# We have used a current version of Java 8
mkdir /opt/talend
SET constraint_exclusion = on;
EXPLAIN select count(*) from partitioned.transaction where customer_id = 'A5162879360'
delete from partitioned.transaction_bucket_8
select * from partitioned.transaction_bucket_8
insert into partitioned.transaction select * from transaction limit 10000
CREATE TRIGGER transaction_insert_trigger
BEFORE INSERT
ON partitioned.transaction
FOR EACH ROW
EXECUTE PROCEDURE partitioned.transaction_insert_trigger();
CREATE OR REPLACE FUNCTION partitioned.transaction_insert_trigger()
RETURNS trigger AS
$BODY$
DECLARE
bucket integer;
BEGIN
bucket := partitioned.calcbucket(NEW.customer_id, 50);
INSERT INTO partitioned.bucket_debug VALUES (bucket, NEW.customer_id);
IF (bucket = 0) THEN
INSERT INTO partitioned.transaction_bucket_0 VALUES (NEW.*);