Hello all!
Thanks for attending this 6th Hublo Growth! 🪴
On the menu today:
- RFCs
- ADRs
- Radar
| /** | |
| * Module for dealing with I/O. | |
| * | |
| * This avoid us to re-invent the wheel all the time. | |
| * We write functions once, test them once, compose and reuse them | |
| * throughout the project. | |
| * | |
| * We provide helper functions for dealing with streams | |
| * as they are super helpful but might come with non-straightforward | |
| * boilerplate. |
| import math | |
| import matplotlib.pyplot as plt | |
| def calculate_solar_flux(latitude, longitude, panel_orientation, panel_tilt, hour, day_of_year): | |
| # Convertit tous les angles en radians | |
| latitude = math.radians(latitude) | |
| panel_orientation = math.radians(panel_orientation) | |
| panel_tilt = math.radians(panel_tilt) | |
| declination = math.radians(23.45 * math.sin(2 * math.pi * (day_of_year - 81) / 365.0)) | |
| hour_angle = math.radians(15 * (12 - hour)) |
| cat /Users/valentinmouret/Desktop/users.csv \ | |
| | psql -c " | |
| begin; | |
| create temp table batch_user ( | |
| id text primary key, | |
| document jsonb not null | |
| ); |
| -- By beginning a transaction, you ensure | |
| -- that you won't break anything. | |
| -- You can always rollback. | |
| begin; | |
| create temp table batch_user ( | |
| -- Enforcing a primary key slows down the processing | |
| -- but it helps you making sure you don't have duplicates | |
| -- in your batch. | |
| id text primary key, |
| for id, document in csv: | |
| connection.execute( | |
| """ | |
| insert into user | |
| (id, email) | |
| values (%s, ($s::jsonb)->>'email'); | |
| """, | |
| [id, document], | |
| ) |
| id | document | |
|---|---|---|
| c4ca4238a0b923820dcc509a6f75849b | {"email": "foo@bar.com"} | |
| c81e728d9d4c2f636f067f89cc14862c | {"email": "alice@bob.com"} |
| insert into user | |
| (id, email) | |
| values ('c4ca4238a0b923820dcc509a6f75849b', 'foo@bar.com'), | |
| ('c81e728d9d4c2f636f067f89cc14862c', 'alice@bob.org'); |
| create table user ( | |
| id text primary key, | |
| email text not null | |
| ); |
| alter table firestore.collection | |
| add column author text generated always as (document->>'author') stored; | |
| create index firestore_collection_author_idx | |
| on firestore.collection (author); |