Skip to content

Instantly share code, notes, and snippets.

@vfr292
vfr292 / celery_worker.py
Last active November 6, 2018 17:20
Celery logging with a mail handler and filter
import os, logging, random, string
from celery.signals import after_setup_logger
from celery.app.log import TaskFormatter
from car_listing_flask_app.app import celery, app_factory
from car_listing_flask_app.utilities.s3_internal_static_file_download import download_internal_static_files
from car_listing_flask_app.utilities.logging_set_up import SparkPostMailHandler
environment_import_path = os.environ['APP_SETTINGS']
app = app_factory(environment_import_path)
@vfr292
vfr292 / review_postgres_sql-alchmey_json_field_properties.py
Last active June 28, 2018 15:53
A review of querying/searching and mutability tracking on Postgres SQL JSON and JSONB field implementations using SQLAlchemy and Sqlalchemy-Json
import json
from contextlib import contextmanager
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.types import JSON
@vfr292
vfr292 / discriminator_on_association_with_eager_loading.py
Created November 25, 2014 07:01
discriminator_on_association_with_eager_loading.py
'''
Created on Oct 22, 2014
@author: Victor
On 20141124 I asked about how to eager load the parent. The code, I submitted with the post is located at:https://gist.github.com/vfr292/a5939418285e4c8bd03b
'''
@vfr292
vfr292 / discriminator_on_association_with_eager_loading.py
Created November 24, 2014 05:56
SQL Alchemy Generic Association Eager Loading''' Created on Oct 22, 2014 @author: Victor ''' """discriminator_on_related.py Illustrates a mixin which provides a generic association using a single target table and a single association table, referred to by all parent tables. The association table contains a "discriminator" column which determines…
'''
Created on Oct 22, 2014
@author: Victor
'''
"""discriminator_on_related.py
Illustrates a mixin which provides a generic association
using a single target table and a single association table,