Skip to content

Instantly share code, notes, and snippets.

View haleemur's full-sized avatar

Hal Ali haleemur

  • 1Password
  • Montreal, Canada
View GitHub Profile
@haleemur
haleemur / using-model-columns-in-dbt.sql
Last active February 17, 2021 04:15
using model.columns in dbt
the view definition
```sql
-- target_view.sql
{%- set frame = 'OVER (PARTITION BY transaction_id ORDER BY id DESC)' -%}
SELECT DISTINCT
transaction_id
{%- for f in model['columns'] -%}
{% if f != 'transaction_id' %}
, FIRST_VALUE({{ f }}) {{ frame }} AS {{ f }}
{%- endif -%}
@haleemur
haleemur / pip_upgrade.md
Last active August 29, 2015 14:23
upgrading all installed python files via pip
sudo pip3 freeze | awk -F "==" '{print $1}' | xargs sudo pip3 install --upgrade

I've struggled with this before. So, I'm writing it down for future reference.

AFAIK, pip doesn't support upgrading packages en-masse. But with shell piping, we can achieve the equivalent of

pip install --upgrade ALL.

And, its usually the 2nd part of the pipe that I get stuck on, because I'm not very AWKward (hehe, bad pun for myself).