from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

from performanceplatform.collector.ga.core \
    import create_client, query_documents_for, send_data

from performanceplatform.collector.write import DataSet


def main(credentials, data_set_config, query, options, start_at, end_at):
    client = create_client(credentials)

    documents = query_documents_for(
        client, query, options,
        data_set_config['data-type'], start_at, end_at
    )

    data_set = DataSet.from_config(data_set_config)
    send_data(data_set, documents)

from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

from performanceplatform.collector.ga.core \
    import create_client, query_documents_for, send_data

from performanceplatform.collector.write import DataSet


def main(credentials, data_set_config, query, options, start_at, end_at):
    client = create_client(credentials)

    documents = query_documents_for(
        client, query, options,
        options.get('dataType', data_set_config['data-type']),
        start_at, end_at)

    data_set = DataSet.from_config(data_set_config)
    send_data(data_set, documents)

Allow the 'dataType' field to be overriden
Allow the 'dataType' field to be overriden

The 'dataType' field in records predates data groups and data types. As
such they don't always match the new world order of data types. It's
fine to change in all cases other than Licensing which is run on
limelight, that we don't really want to touch.

  from pkgutil import extend_path
  __path__ = extend_path(__path__, __name__)
  
  from performanceplatform.collector.ga.core \
      import create_client, query_documents_for, send_data
  
  from performanceplatform.collector.write import DataSet
  
  
  def main(credentials, data_set_config, query, options, start_at, end_at):
      client = create_client(credentials)
  
      documents = query_documents_for(
          client, query, options,
-         data_set_config['data-type'], start_at, end_at
-     )
+         options.get('dataType', data_set_config['data-type']),
+         start_at, end_at)
  
      data_set = DataSet.from_config(data_set_config)
      send_data(data_set, documents)
  
Allow the 'dataType' field to be overriden
## Code Before:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

from performanceplatform.collector.ga.core \
    import create_client, query_documents_for, send_data

from performanceplatform.collector.write import DataSet


def main(credentials, data_set_config, query, options, start_at, end_at):
    client = create_client(credentials)

    documents = query_documents_for(
        client, query, options,
        data_set_config['data-type'], start_at, end_at
    )

    data_set = DataSet.from_config(data_set_config)
    send_data(data_set, documents)

## Instruction:
Allow the 'dataType' field to be overriden
## Code After:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

from performanceplatform.collector.ga.core \
    import create_client, query_documents_for, send_data

from performanceplatform.collector.write import DataSet


def main(credentials, data_set_config, query, options, start_at, end_at):
    client = create_client(credentials)

    documents = query_documents_for(
        client, query, options,
        options.get('dataType', data_set_config['data-type']),
        start_at, end_at)

    data_set = DataSet.from_config(data_set_config)
    send_data(data_set, documents)
