Skip to content

Instantly share code, notes, and snippets.

@devrishik
devrishik / django_docker_postgres_dumper.py
Created May 7, 2021 22:19
Django docker dbbackup connector
#!/usr/bin/env python3
"""
ABSTRACT:
---------
Backup utility for all databases
In a microservice world we have postgres running in one docker container and the services on their own containers.
Such a scenario calls for backing up multiple databases other than those managed by Django.
This file presents an extended connector to django-dbbackup's PgDumpBinaryConnector to use
`pg_dump/pg_restore` tools from the postgres container only
This connector should be paired with a management command
@devrishik
devrishik / PostgreSQL JSON Indexing and Django Models references
Last active January 10, 2024 17:36
A quick cook book to Postgres indexes and Django model references
Django provides references to all of the existing indexes in Postgres.
Django managers can be used for managing indexes dynamically, a handle
can be provided as IndexManager to extend for custom querysets or raw sql queries.
PostGres
--------
Types of indexes: https://www.postgresql.org/docs/9.1/indexes-types.html
BRIN: Block Range Index: good for comparing blocks with relative location data
Btree (default): @> <> =:
@devrishik
devrishik / blog_1
Created June 26, 2013 10:10
A Javascript noob's guide to Node + Express + Compound.JS
This blog represents all the wrong doings of a first time programmer into javascript domain
To start with lets beging with a short explaination of these technologies
Node: The very basic layer required by you to create a website
Thats the best thing about it, imagine an app working without any middle-ware, thus improving the performance
Express: An upper layer for Node to make things a little easier and more abstract
Compound: The top layer built specially to be used over Express. It is down right translation of RoR