<commit_before># Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
resources:

  - type: bigquery_table
    table_id: sales
    description: "Sales Dataset"
dag:
  airflow_version: 2
  initialize:
    dag_id: sales
    default_args:
      owner: "Google"
      depends_on_past: False
      start_date: '2021-03-01'
    max_active_runs: 1
    schedule_interval: "@weekly"
    catchup: False
    default_view: graph

  tasks:
    - operator: "KubernetesPodOperator"
      description: "Run CSV transform within kubernetes pod"
      args:
        task_id: "transform_csv"
        startup_timeout_seconds: 600
        name: "Sales"
        namespace: "composer"
        service_account_name: "datasets"
        image_pull_policy: "Always"
        image: "{{ var.json.iowa_liquor_sales.container_registry.run_csv_transform_kub }}"
        env_vars:
          SOURCE_URL: "https://data.iowa.gov/api/views/m3tr-qhgy/rows.csv"
          SOURCE_FILE: "files/data.csv"
          TARGET_FILE: "files/data_output.csv"
          CHUNKSIZE: "1000000"
          TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
          TARGET_GCS_PATH: "data/iowa_liquor_sales/sales/data_output.csv"

        resources:
          request_memory: "8G"
          request_cpu: "4"
          request_ephemeral_storage: "32G"

    - operator: "GoogleCloudStorageToBigQueryOperator"
      description: "Task to load CSV data to a BigQuery table"

      args:
        task_id: "load_to_bq"
        bucket: "{{ var.value.composer_bucket }}"
        source_objects: ["data/iowa_liquor_sales/sales/data_output.csv"]
        source_format: "CSV"
        destination_project_dataset_table: "iowa_liquor_sales.sales"
        skip_leading_rows: 1
        allow_quoted_newlines: True
        write_disposition: "WRITE_TRUNCATE"

        schema_fields:
          - name: "invoice_and_item_number"
            type: "STRING"
            mode: "NULLABLE"
            description: "Concatenated invoice and line number associated with the liquor order. This provides a unique identifier for the individual liquor products included in the store order."
          - name: "date"
            type: "DATE"
            description: "Date of order"
            mode: "NULLABLE"
          - name: "store_number"
            type: "STRING"
            description: "Unique number assigned to the store who ordered the liquor."
            mode: "NULLABLE"
          - name: "store_name"
            type: "STRING"
            description: "Name of store who ordered the liquor."
            mode: "NULLABLE"
          - name: "address"
            type: "STRING"
            description: "Address of store who ordered the liquor."
            mode: "NULLABLE"
          - name: "city"
            type: "STRING"
            description: "City where the store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "zip_code"
            type: "STRING"
            description: "Zip code where the store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "store_location"
            type: "STRING"
            description: "Location of store who ordered the liquor. The Address, City, State and Zip Code are geocoded to provide geographic coordinates. Accuracy of geocoding is dependent on how well the address is interpreted and the completeness of the reference data used."
            mode: "NULLABLE"
          - name: "county_number"
            type: "STRING"
            description: "Iowa county number for the county where store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "county"
            type: "STRING"
            description: "County where the store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "category"
            type: "STRING"
            description: "Category code associated with the liquor ordered"
            mode: "NULLABLE"
          - name: "category_name"
            type: "STRING"
            description: "Category of the liquor ordered."
            mode: "NULLABLE"
          - name: "vendor_number"
            type: "STRING"
            description: "The vendor number of the company for the brand of liquor ordered"
            mode: "NULLABLE"
          - name: "vendor_name"
            type: "STRING"
            description: "The vendor name of the company for the brand of liquor ordered"
            mode: "NULLABLE"
          - name: "item_number"
            type: "STRING"
            description: "Item number for the individual liquor product ordered."
            mode: "NULLABLE"
          - name: "item_description"<commit_msg>feat: Update "location" to GEOGRAPHY type for `datasets/google_trends` schema (#297)<commit_after># Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
resources:

  - type: bigquery_table
    table_id: sales
    description: "Sales Dataset"
dag:
  airflow_version: 2
  initialize:
    dag_id: sales
    default_args:
      owner: "Google"
      depends_on_past: False
      start_date: '2021-03-01'
    max_active_runs: 1
    schedule_interval: "@weekly"
    catchup: False
    default_view: graph

  tasks:
    - operator: "KubernetesPodOperator"
      description: "Run CSV transform within kubernetes pod"
      args:
        task_id: "transform_csv"
        startup_timeout_seconds: 600
        name: "Sales"
        namespace: "composer"
        service_account_name: "datasets"
        image_pull_policy: "Always"
        image: "{{ var.json.iowa_liquor_sales.container_registry.run_csv_transform_kub }}"
        env_vars:
          SOURCE_URL: "https://data.iowa.gov/api/views/m3tr-qhgy/rows.csv"
          SOURCE_FILE: "files/data.csv"
          TARGET_FILE: "files/data_output.csv"
          CHUNKSIZE: "1000000"
          TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
          TARGET_GCS_PATH: "data/iowa_liquor_sales/sales/data_output.csv"

        resources:
          request_memory: "8G"
          request_cpu: "4"
          request_ephemeral_storage: "32G"

    - operator: "GoogleCloudStorageToBigQueryOperator"
      description: "Task to load CSV data to a BigQuery table"

      args:
        task_id: "load_to_bq"
        bucket: "{{ var.value.composer_bucket }}"
        source_objects: ["data/iowa_liquor_sales/sales/data_output.csv"]
        source_format: "CSV"
        destination_project_dataset_table: "iowa_liquor_sales.sales"
        skip_leading_rows: 1
        allow_quoted_newlines: True
        write_disposition: "WRITE_TRUNCATE"

        schema_fields:
          - name: "invoice_and_item_number"
            type: "STRING"
            mode: "NULLABLE"
            description: "Concatenated invoice and line number associated with the liquor order. This provides a unique identifier for the individual liquor products included in the store order."
          - name: "date"
            type: "DATE"
            description: "Date of order"
            mode: "NULLABLE"
          - name: "store_number"
            type: "STRING"
            description: "Unique number assigned to the store who ordered the liquor."
            mode: "NULLABLE"
          - name: "store_name"
            type: "STRING"
            description: "Name of store who ordered the liquor."
            mode: "NULLABLE"
          - name: "address"
            type: "STRING"
            description: "Address of store who ordered the liquor."
            mode: "NULLABLE"
          - name: "city"
            type: "STRING"
            description: "City where the store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "zip_code"
            type: "STRING"
            description: "Zip code where the store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "store_location"
            type: "GEOGRAPHY"
            description: "Location of store who ordered the liquor. The Address, City, State and Zip Code are geocoded to provide geographic coordinates. Accuracy of geocoding is dependent on how well the address is interpreted and the completeness of the reference data used."
            mode: "NULLABLE"
          - name: "county_number"
            type: "STRING"
            description: "Iowa county number for the county where store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "county"
            type: "STRING"
            description: "County where the store who ordered the liquor is located"
            mode: "NULLABLE"
          - name: "category"
            type: "STRING"
            description: "Category code associated with the liquor ordered"
            mode: "NULLABLE"
          - name: "category_name"
            type: "STRING"
            description: "Category of the liquor ordered."
            mode: "NULLABLE"
          - name: "vendor_number"
            type: "STRING"
            description: "The vendor number of the company for the brand of liquor ordered"
            mode: "NULLABLE"
          - name: "vendor_name"
            type: "STRING"
            description: "The vendor name of the company for the brand of liquor ordered"
            mode: "NULLABLE"
          - name: "item_number"
            type: "STRING"
            description: "Item number for the individual liquor product ordered."
            mode: "NULLABLE"
          - name: "item_description"
{'fraction_non_alphanumeric': 0.08004973221117062, 'fraction_numerical': 0.006790359602142311, 'mean_word_length': 2.2066850659306962, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7147210', 'n_tokens_mistral': 2937, 'n_tokens_neox': 2791, 'n_words': 958}