Recipe: A DRY framework for querying data — Recipe 0.1.0 documentation

# Recipe: A DRY framework for querying data

Release v0.1.0. (Installation)

Recipe is an MIT licensed cross-database querying library, written in Python. It allows you to reuse SQL fragments to answer data questions consistently. Extension classes allow you to support data anonymization, automatic generation of where clauses, user permissioning to data, subselects, and response formatting.

    >>> shelf = Shelf({ 'age': WtdAvgMetric(Census.age, Census.pop2000), 'state', Dimension(Census.state)})
    >>> recipe = Recipe().shelf(shelf).metrics('age').dimensions('state').order_by('-age')

    >>> recipe.to_sql()
    SELECT census.state AS state,
           CAST(sum(census.age * census.pop2000) AS FLOAT) / (coalesce(CAST(sum(census.pop2000) AS FLOAT), 0.0) + 1e-09) AS age
    FROM census
    GROUP BY census.state
    ORDER BY CAST(sum(census.age * census.pop2000) AS FLOAT) / (coalesce(CAST(sum(census.pop2000) AS FLOAT), 0.0) + 1e-09) DESC

    >>> recipe.dataset.csv
    state,age,state_id
    Florida,39.08283934000634,Florida
    West Virginia,38.555058651148165,West Virginia
    Maine,38.10118393261269,Maine
    Pennsylvania,38.03856695544053,Pennsylvania
    ...

## User’s Guide

This guide covers installation, the core concepts to get you started, available extensions, connecting to databases and caching.

- Introduction
  - Recipe License
  - Pythons Supported

- Installation
  - Installing Recipe
  - Download the Source

- Quickstart
  - Creating a Shelf
  - Using the Shelf to build a Recipe
  - Viewing the data from your Recipe
- More about Ingredients
  - Types of Ingredients
    - Dimension
    - IdValueDimension
    - LookupDimension
    - Metric
    - DivideMetric
    - WtdAvgMetric
    - SumIfMetric
    - CountIfMetric
    - Filter
    - Having
  - Formatters
  - Building filters
  - Storing extra attributes in meta
- Using Extensions
  - Automatic Filtering
  - Summarizing over Dimensions
  - Merging multiple tables
  - Adding comparison data
  - Anonymizing data
- Advanced Features
  - Database connections
  - Caching
  - Running recipes in parallel with RecipePool
- Ovens
  - Initializing an Oven
  - Oven Drivers
- Hooks

## API Reference

If you are looking for information on a specific function, class or method, this part of the documentation is for you.

- API
  - Recipe Object
  - Shelf Object
  - Ingredients
  - Functions
  - Exceptions

## Development

To add features, extensions or ingredients to Recipe see our development guide.

- Development
  - Conventions
  - Source Control
  - Adding New Extensions
  - Adding New Ingredients
  - Testing Recipe
  - Continuous Integration
  - Building the Docs
- Custom Oven Drivers
  - OvenBase
- Dynamic Extensions
  - DynamicExtensionBase