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
| # https://danielms.site/blog/requirements-txt-to-poetry-pyproject-toml/ | |
| # requirements.txt to pyproject.toml | |
| cat requirements.txt | grep -E '^[^# ]' | cut -d= -f1 | xargs -n 1 poetry add |
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
| with tt1 as (select 1 as time, null as val union all | |
| select 2, 1 union all | |
| select 3, null union all | |
| select 4, null union all | |
| select 5, null union all | |
| select 6, 0 union all | |
| select 7, null union all | |
| select 8, null | |
| ) | |
| select * |
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
| -- https://cloud.google.com/bigquery/docs/reference/standard-sql/pipe-syntax | |
| from etl.ripley_invoice_lines_insight rili | |
| |> where project_id = '6733cbe25336c776feafa158' | |
| |> aggregate sum(net_fcy_rfv) as total_amount | |
| group by project_id, invoice_id, invoice_action, transaction_currency, functional_currency | |
| -- /*debug*/ |> select *; | |
| |> EXTEND current_timestamp() as current_timestamp |
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
| -- https://stackoverflow.com/questions/64043166/aggregate-same-row-groups-into-one-row | |
| with tt1 as ( | |
| select invoice_id, project_id, invoice_action, ll.line_item_id, ll.line_item_action | |
| from api.invoice_lines_lifecycle ll | |
| where true | |
| and ll.plan_type = 'domain' | |
| and ll.invoice_lifecycle = 'AccountingInvoiceFinalizedEvent' | |
| and ll.project_id = '6670e53320098f4e87e5dd50' | |
| ) | |
| -- select t, (SELECT AS STRUCT * EXCEPT(line_item_id, line_item_action) FROM UNNEST([t])) |
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
| # Example for 'banding' value in column A2+ | |
| # Format, Conditional formatting: | |
| Custom Formula | |
| Apply to range: A2:U50 | |
| Formula: =ISODD(MATCH($A2, UNIQUE($A$2:$A2),0)) | |
| # ArrayFormula: | |
| ={"gg";ARRAYFORMULA( |
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
| # 1) Run in Terminal: | |
| # This adds a subl alias to /usr/local/bin/ pointing to Sublime Text 3 app’s binary file. | |
| # Now running subl in Terminal will launch Sublime Text 3 app. | |
| sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl | |
| # 2) Run in Terminal: | |
| git config --global core.editor "subl -n -w" |
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
| csv_file_name = get_file_name(execution_date=context['execution_date'], ripley_table_name=self.ripley_table_name) | |
| LOGGER.info('Uploading %s to %s' % (csv_file_name, self.gcs_bucket_name)) | |
| # Ensure that we properly encode and escape the JSON string | |
| pandas_df['payload'] = pandas_df['payload'].apply(json.dumps) | |
| pandas_df['schema'] = pandas_df['schema'].apply(json.dumps) | |
| correct_csv = pandas_df.to_csv(encoding='utf-8', header=False, index=False, doublequote=True, quoting=csv.QUOTE_ALL) | |
| blob = bucket.blob(csv_file_name) | |
| blob.content_encoding = "gzip" |
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
| # add at the end of dag file | |
| if __name__ == "__main__": | |
| from airflow.utils.state import State | |
| dag.clear() | |
| dag.run() |
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
| adb connect 127.0.0.1:5555 && cd /d s:\git\headless_adb && .\venv\Scripts\python.exe epic7.py |
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
| # Activate console to run "bq" commands: | |
| # https://console.cloud.google.com/bigquery?cloudshell=true | |
| # bq show --format=prettyjson bigquery-public-data:samples.wikipedia | jq '.schema.fields' | |
| bq show --format=prettyjson <project>:<bucket>.<table> | jq '.schema.fields' |
NewerOlder