Code Monkey home page Code Monkey logo

client-side-events's Introduction

Client side events Job and Table Inserter

This project is able to do two things:

  • create daily tables for client side events project.

  • run scheduled queries (currently 4- and 24-hour intervals)

Table Inserter Configuration

The configuration file (src/main/resources/table-inserter-config.json) specifies one or more table schemas ,each having one or more fields:

{
  "includeCurrentDay": true,
  "numberOfDays": 3,
  "tables": [
    {
      "projectId": "project-id",
      "dataset": "dataset",
      "tableNamePrefix": "prefix",
      "fields": [
        {
          "name": "field1",
          "type": "string",
          "nullable": false
        }
      ]
    },
  ]
}

Table names will be of the format [tableNamePrefix]YYYYMMDD for use in table date range queries.

Job Inserter Configuration

To add a query, you need to modify the configuration file (src/main/resources/job-inserter-config.json) and add a query under src/main/resources/queries/

The configuration file follows the following schema:

{
  "projectId": "billing-project",
  "configuration": {
    "query": {
      "writeDisposition": "WRITE_TRUNCATE",
      "destinationTable": {
        "projectId": "destination-project",
        "datasetId": "destination_dataset"
      }
    }
  },
  "every4Hours": [
    {
      "destinationTableId": "destination_table_name",
      "fileName": "queries/query-file-name.sql"
    }
  ],
  "every24Hours": [
    ...
  ]
}

The query result will be stored in [destination-project:destination_dataset.destination_table_name].

N.B. 1. the billing project, destination project, and destination dataset are currently global configuration options that are identical for all jobs.

N.B. 2. the results will overwrite the previous contents of the table

Usage

  • Set up the configuration files as required
  • Deploy to an appengine project having service account permissions to the target table project
mvn appengine:update -Dappengine.appId=project-app-id -Ddeploy.version=[version-num] -Ddeploy.module=[default | module-name]

Troubleshooting job scheduler

To test the job scheduler, make a request for /insertJobs?interval=x where x is the interval that includes the new jobs. If the job does not cause the target table to be updated, use bq ls -a -j client-side-events and look for failures. Then use bq show -j <job_id> and look for the error message.

Unit Tests

mvn test

Integration Tests

mvn verify

Note: Requires a json service account file. The file path should be specified by the environment variable GOOGLE_APPLICATION_CREDENTIALS

client-side-events's People

Contributors

adituriya avatar ahmedalsudani avatar alex-deaconu avatar alexey-rise avatar dependabot[bot] avatar donnapep avatar ezequielc avatar jungeunyoon avatar rodrigopavezi avatar rudibravo avatar santiagonoguez avatar settinghead avatar stulees avatar tejohnso avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.