Watch a table for changes and push a notification with a payload describing the change.
In the Postgres shell:
-- Create the functions
Watch a table for changes and push a notification with a payload describing the change.
In the Postgres shell:
-- Create the functions
This is an example usage of registering an update_hook to a SQLite connection. The motivation for exploring this feature is to test out various implementations of data monitoring interfaces.
A few notable properties of the implementation:
INSERT and UPDATE operation requires a subsequent SELECT to get the row data.bufsize under heavy workloads will improve throughput, but the SQLite library is single-threaded by design.Managment commands are assumed to be unique across all apps in a Django project. This can lead to long or obscure command names in attempt to namespace those commands.
Subcommander acts as a proxy command giving the real commands a namespace. The subcommander module can be named after the app name or some derivation. The structure looks as follows:
myapp/
management/
commands/| import string | |
| from random import SystemRandom | |
| from django.db import connections | |
| key_chars = string.ascii_letters | |
| random = SystemRandom() | |
| class adhoc_db(object): | |
| """Context manager that temporarily adds a database connection. |
| package main | |
| import ( | |
| "reflect" | |
| "testing" | |
| ) | |
| type myint int64 | |
| type Inccer interface { |
| import inspect | |
| from django.conf import settings | |
| from django.utils.importlib import import_module | |
| from django.core.exceptions import ImproperlyConfigured | |
| class AlreadyRegistered(Exception): | |
| pass | |
| from datetime import datetime | |
| from django.db import models | |
| from django.core.cache import cache | |
| class ModifiedModel(models.Model): | |
| modified = models.DateTimeField() | |
| class Meta(object): | |
| abstract = True |
Markdown version of Seth Godin's ShipIt Journal
You may have already figured out these reasons for not shipping:
| #!/bin/bash | |
| /usr/sbin/usermod -aG docker <user> |