This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
import resource | |
from clickhouse_driver import Client | |
def memory_usage(): | |
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax = docker/dockerfile:experimental | |
ARG PYTHON_VERSION=3.7.6 | |
ARG APP_ENV=prod | |
# --------------------------------------------------------------- | |
FROM python:${PYTHON_VERSION}-stretch AS base-builder | |
ENV VIRTUAL_ENV=/opt/venv | |
RUN python -m venv ${VIRTUAL_ENV} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- usage: | |
-- CALL update_table_in_batches('table_1', array['a = 1'], batch_size := 10); | |
-- CALL update_table_in_batches('table_2', array['b = 2'], track_by := 'created', initial_value := '2021-01-01'::timestamp); | |
CREATE OR REPLACE PROCEDURE update_table_in_batches( | |
target_table text, | |
set_expressions text[], | |
track_by text default 'id', | |
initial_value anyelement default 0, | |
batch_size integer default 1000, |