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 boto3 | |
import logging | |
import botocore | |
from typing import Optional | |
from botocore.exceptions import ClientError | |
AWS_ACCESS_KEY_ID = 'AKIAS7AVEMA4RPAVEMAA' | |
AWS_SECRET_ACCESS_KEY = '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' |
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 sqlite | |
conn = sqlite3.connect(database='my_cool_db.sqlite3') | |
# conn.row_factory = sqlite3.Row # not the prettiest option | |
conn.row_factory = lambda c, r: dict([(col[0], r[idx]) for idx, col in enumerate(c.description)]) | |
cursor = self.conn.cursor() | |
result = cursor.execute("SELECT * FROM test WHERE name='myname';") |
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
from django.db import connection, reset_queries | |
import time | |
import functools | |
def query_debugger(func): | |
@functools.wraps(func) | |
def inner_func(*args, **kwargs): | |
reset_queries() |