Skip to content

Instantly share code, notes, and snippets.

View joaoheron's full-sized avatar
🏠
Working from home

João Heron joaoheron

🏠
Working from home
  • BR
View GitHub Profile
@joaoheron
joaoheron / match_tags.sh
Created June 25, 2025 01:01
Find BigQuery tables with a specific Tag Binding using bq CLI
#!/bin/bash
PROJECT_ID="your-project-id"
TAG_VALUE="tagValues/123456789"
REGION="us"
matching_resources=()
for DATASET_ID in $(bq ls --max_results=1000 --project_id="$PROJECT_ID" | awk 'NR>2 {print $1}'); do
echo "--Checking dataset: $DATASET_ID"
@joaoheron
joaoheron / copy_table_from_source_to_target.py
Last active May 11, 2021 03:45
Copy and Load MySQL or PostgreSQL tables using Pandas and SqlAlchemy
from os import path
from argparse import ArgumentParser
import psycopg2
import pandas as pd
from sqlalchemy import create_engine
def main(source_uri, source_table, target_uri, target_table, if_exists='replace', method='multi', chunksize=5000, **kwargs):
"""This main function extracts a table from a database and loads
@joaoheron
joaoheron / access_postgresql_with_docker.md
Created October 8, 2020 21:08 — forked from MauricioMoraes/access_postgresql_with_docker.md
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf