React.js: the basics

Basic element creation: ReactDOM.render(React.createElement(‘h1’, null, ‘Hello world!’),document.getElementById(‘content’)) The first argument, the element The second: the data to be feed to that element The third, the innerHTML inside that element ReactDOM.render does the actual appending to the page React Hooks Example (look ma’ no classes!): const GeneralStats = () => { useEffect(() => { // fetch […]

Redshift: alter table column TYPE is not allowed

Only allowed for varchar column types. The trick to get it done: ALTER TABLE sometable ADD COLUMN some_new_column (with the new definition you want) UPDATE sometable SET some_new_column = old_column; ALTER TABLE sometable DROP COLUMN old_column; ALTER TABLE sometable RENAME COLUMN some_new_column TO old_column; The catch: column order will be altered (the new column will […]

AWS lambda: the basics

For a API Gate / Lambda combo, there is a bit of a gotch¬†when setting those two services together and following their hello world example. Instead of the default in their example: # print(“value2 = ” + event[‘key2’]) use: event[‘params’][‘querystring’][‘key1’] I wish it was more evident in their documentation what “event” means, but basically, after […]