In the celery documentation: instantiation
We see a great example of using a base task to cache a database connection: