=====
Usage
=====

To use LookML Generator in a project::

    from lookmlgen import view
    from lookmlgen import field

    v = view.View('my_view')
    v.add_field(field.Dimension('id', sql='${TABLE}.id', type='number', primary_key=True))
    v.add_field(field.Dimension('c', sql='${TABLE}.c', type='number'))
    v.add_field(field.Measure('sum_c', sql='${TABLE}.c', type='sum'))

    with open('my_view.lkml', 'w') as f:
        v.generate_lookml(f)

The contents of 'my_view.lkml' will be::

    # STOP! This file was generated by an automated process.
    # Any edits you make will be lost the next time it is
    # re-generated.
    view: my_view {

      dimension: c {
        type: number
        sql: ${TABLE}.c ;;
      }

      dimension: id {
        primary_key: yes
        type: number
        sql: ${TABLE}.id ;;
      }

      measure: sum_c {
        type: sum
        sql: ${TABLE}.c ;;
      }
    }
