gcloud topic configurations
This file contains hidden or 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
| -- duration of task instances | |
| select | |
| date(execution_date) as dt, | |
| avg(duration) as avg_duration, | |
| min(duration) as min_duration, | |
| max(duration) as max_duration | |
| from | |
| task_instance | |
| group by | |
| date(execution_date) |
This file contains hidden or 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
| -- Fixed-length ascii strings | |
| CREATE OR REPLACE FUNCTION pg_temp.random_string(int) RETURNS text | |
| AS $$ SELECT | |
| array_to_string(ARRAY(SELECT chr(ascii('B') + round(random() * 25)::integer) | |
| FROM | |
| generate_series(1, $1)), '') $$ | |
| LANGUAGE sql; | |
| select pg_temp.random_string(8); |
This file contains hidden or 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
| ----------------------------------------------------------------------------------------------------------------------------------- | |
| -- USEFUL POSTGRESQL MANAGEMENT QUERIES -- | |
| -- See https://medium.com/compass-true-north/dealing-with-significant-postgres-database-bloat-what-are-your-options-a6c1814a03a5 -- | |
| ----------------------------------------------------------------------------------------------------------------------------------- | |
| -- SHOW RUNNING QUERIES | |
| SELECT | |
| state, | |
| pid, |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """OLD AND UNTESTED""" | |
| import unicodedata | |
| def fix_bad_unicode(text): | |
| u""" | |
| Something you will find all over the place, in real-world text, is text | |
| that's mistakenly encoded as utf-8, decoded in some ugly format like |
This file contains hidden or 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
| """Amazon Marketplace and Region Info. | |
| * [MWS docs](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html) | |
| * [Advertising API docs](https://advertising.amazon.com/API/docs/en-us/get-started/how-to-use-api) | |
| """ | |
| from dataclasses import dataclass | |
| @dataclass |
This file contains hidden or 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
| version: 2.1 | |
| jobs: | |
| test-cf-audit-report-data: | |
| docker: | |
| - image: circleci/python:3.7.1 | |
| - image: circleci/postgres:11.4-alpine-ram | |
| environment: | |
| POSTGRES_USER: user | |
| POSTGRES_DB: test |
This file contains hidden or 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
| from sqlalchemy import create_engine, Table, MetaData | |
| from sqlalchemy.schema import CreateIndex, CreateTable | |
| metadata = MetaData() | |
| engine = create_engine('') | |
| def create_table_statement(connection, table): | |
| stmts = [] |