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
| # Hits the database | |
| team_queryset = Team.objects.select_related("user").get(name="tigers") | |
| # The second line doesn't hit the database, because team_queryset.user has been previously prepopulated | |
| user = team_queryset.user |
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
| import boto3 | |
| from settings import AWS_PROFILE | |
| database_name = "test" | |
| new_database_name = "newdb" | |
| table_name = "table_name" | |
| new_table_name = "new_table_name" | |
| session = boto3.session.Session(profile_name=AWS_PROFILE) | |
| client = session.client("glue") |
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
| -- monitorear queries con los costos más altos | |
| WITH WAREHOUSE_SIZE AS | |
| ( | |
| SELECT WAREHOUSE_SIZE, NODES | |
| FROM ( | |
| SELECT 'XSMALL' AS WAREHOUSE_SIZE, 1 AS NODES | |
| UNION ALL | |
| SELECT 'SMALL' AS WAREHOUSE_SIZE, 2 AS NODES | |
| UNION ALL | |
| SELECT 'MEDIUM' AS WAREHOUSE_SIZE, 4 AS NODES |
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
| import sys | |
| from pyspark.sql import SparkSession | |
| import logging | |
| APP_NAME = "Elastic Bulk loader" | |
| INPUT_PATH = "gs://PATH/TO/THE/PARQUETS" | |
| OUTPUT_PATH = "gs://PATH/TO/THE/PARQUETS" | |
| ELASTIC_HOST = "http://localhost" | |
| WRITE_MODE = "append" |
OlderNewer