Skip to content

Instantly share code, notes, and snippets.

View pmbrull's full-sized avatar
Building OpenMetadata

Pere Miquel Brull pmbrull

Building OpenMetadata
View GitHub Profile
@pmbrull
pmbrull / migration-fix.sql
Created November 8, 2023 05:56
OpenMetadata Release 1.2.0 - Postgres Ingestion Pipeline Migration Fix
UPDATE ingestion_pipeline_entity
SET json = jsonb_set(
json::jsonb #- '{sourceConfig,config,viewParsingTimeoutLimit}',
'{sourceConfig,config,queryParsingTimeoutLimit}',
(json #> '{sourceConfig,config,viewParsingTimeoutLimit}')::jsonb,
true
)
WHERE json #>> '{pipelineType}' = 'metadata'
AND json #>> '{sourceConfig,config,type}' = 'DatabaseMetadata';

Reproducing the steps:

❯ python -m venv venv-012
❯ source venv-012/bin/activate
❯ pip install "openmetadata-ingestion[snowflake,mysql,bigquery]~=0.12.3"
# Pin SQLAlchemy to 1.4 for old release without requirement fix
❯ pip install SQLAlchemy~=1.4
❯ metadata --version
metadata, version metadata 0.12.3.0 from /Users/pmbrull/tests/0123-0131-upgrade/venv-012/lib/python3.9 (python 3.9)
@pmbrull
pmbrull / airflow-2.2.2-constraint.txt
Created October 24, 2022 08:10
airflow 2.2.2 constraint
apache-airflow==2.2.2
@pmbrull
pmbrull / what_the_hash2.py
Created April 10, 2022 17:12
What the hash 2
my_list = [1, 2, 3]
hex(id(my_list)) # 0x104d7a580
my_list.append(4) # mutate the list
hex(id(my_list)) # 0x104d7a580 -> still the same object.
my_string = "Levy"
hex(id(my_string)) # 0x104dec760
my_string += " the cat"
@pmbrull
pmbrull / what_the_hash1.py
Created April 7, 2022 10:48
What the hash 1
data = {"cat": "Lévy", 2: "hello"}
data["cat"] # Lévy
data[2] # hello
@pmbrull
pmbrull / python_truth6.py
Created April 2, 2022 13:55
Python truth 6
if password and get_funds() > 0:
make_transaction()
@pmbrull
pmbrull / python_truth5.py
Created April 2, 2022 13:49
Python truth 5
# The first argument is True
coffee = 10
milk = None
coffee or milk # 10, milk is not evaluated
coffee and milk # None, both expressions are evaluated
# The first argument is False
coffee = None
milk = 5
@pmbrull
pmbrull / python_truth4.py
Created April 1, 2022 16:17
Python truth 4
class Coffee:
def __init__(self, total_amount):
self.total_amount = total_amount
def drink(self, amount):
if amount > self.total_amount:
raise ValueError("Not enough coffee!")
self.total_amount -= amount
def __bool__(self):
@pmbrull
pmbrull / python_truth3.py
Created April 1, 2022 16:07
Python truth 3
count = 0
if not count: # Handles 0 and None
...
if count is None: # Only handles None
...
@pmbrull
pmbrull / python_truth2.py
Created April 1, 2022 15:56
Python truth 2
"""
help(int)
[...]
| __bool__(self, /)
| self != 0
[...]
help(str)