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
| /* psql -E to see internal queries */ | |
| CREATE TEMP TABLE temp_objects AS | |
| SELECT c.oid | |
| ,n.nspname | |
| ,c.relname | |
| ,c.relkind | |
| FROM pg_catalog.pg_class c | |
| LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
| WHERE 1=1 |
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
| """ | |
| module mydjangolib.bigint_patch | |
| A fix for the rather well-known ticket #399 in the django project. | |
| Create and link to auto-incrementing primary keys of type bigint without | |
| having to reload the model instance after saving it to get the ID set in | |
| the instance. | |
| Logs: |
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 celery | |
| from sorl.thumbnail import default | |
| from sorl.thumbnail.images import ImageFile | |
| from sorl.thumbnail.parsers import parse_geometry | |
| from thumbnail import CustomBackend | |
| backend = CustomBackend() |
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 time import time | |
| from functools import wraps | |
| MINUTE = 60 | |
| HOUR = MINUTE * 60 | |
| DAY = HOUR * 24 | |
| class Metrics(object): | |
| def __init__(self, redis, keyspace='metrics'): | |
| self.db = redis |
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
| -- | |
| -- Setup - Add plpgsql, create a parent table, create an initial child table, | |
| -- create the trigger and the initial trigger function. | |
| -- | |
| -- We'll need plpgsql, so create it in your db if it's not already available. | |
| CREATE LANGUAGE plpgsql; | |
| -- Create a table to act as parent with the appropriate columns for your data. | |
| CREATE TABLE my_schema.my_data (name varchar(24), create_date timestamp); |
NewerOlder