Coder Social home page Coder Social logo

dorina-sada / scio-contextual Goto Github PK

View Code? Open in Web Editor NEW

This project forked from regadas/scio-contextual

0.0 0.0 0.0 98 KB

Collection of additional string interpolators to use in your scio pipeline

License: Apache License 2.0

Shell 2.22% Scala 97.78%

scio-contextual's Introduction

scio-contextual

build GitHub license Maven Central

Small library that adds some potencially useful string interpolators to use in your scio pipeline when you need to have things interpreted at compile-time.

libraryDependencies ++= Seq(
  "io.regadas" %% "scio-contextual" % "<version>"
)

Compatibility table

scio-contextual scio
0.1.1 0.8.3
0.1.0 0.8.3

Google BigQuery

import io.regadas.scio.contextual.bigquery._

Valid

spec"projectid:datasetid.tableid"
// res0: com.spotify.scio.bigquery.Table.Spec = Spec(
//   "projectid:datasetid.tableid"
// )

ref"""
{
  "datasetId": "dataset",
  "projectId":  "project",
  "tableId": "table"  
}
"""
// res1: com.spotify.scio.bigquery.Table.Ref = Ref(
//   {"datasetId":"dataset","projectId":"project","tableId":"table"}
// )

Invalid

// project id needs to be at least 6 chars
spec"proj:datasetid.tableid"
// error: Table reference is not in [project_id]:[dataset_id].[table_id] format: proj:datasetid.tableid
// spec"proj:datasetid.tableid"
//      ^^^^^^^^^^^^^^^^^^^^^^^

Google Cloud Pub/Sub

import io.regadas.scio.contextual.pubsub._

Valid

subscription"projects/project-id/subscriptions/subName"
// res3: String = "projects/project-id/subscriptions/subName"

topic"projects/project-id/topics/name"
// res4: String = "projects/project-id/topics/name"

Invalid

// invalid project id

subscription"projects/proj/subscriptions/subName"

topic"projects/proj/topics/name"
// error: Illegal project name: needs to be [a-z][-a-z0-9:.]{4,61}[a-z0-9]
// subscription"projects/proj/subscriptions/subName"
//              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// error: Illegal project name: needs to be [a-z][-a-z0-9:.]{4,61}[a-z0-9]
// topic"projects/proj/topics/name"
//       ^^^^^^^^^^^^^^^^^^^^^^^^^^

Google Cloud Storage

import io.regadas.scio.contextual.gcs._

Valid

gcs"gs://bucket/scio-contextual"
// res6: String = "gs://bucket/scio-contextual"

Invalid

// invalid bucket
gcs"gs://bucket_/scio-contextual"

gcs"gs://bu/scio-contextual"

// wrong schema
gcs"gcs://bucket/scio-contextual"
// error: invalid uri format: gs://[a-z0-9][-_a-z0-9.]+[a-z0-9](/.*)?
// gcs"gs://bucket_/scio-contextual"
//     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// error: invalid uri format: gs://[a-z0-9][-_a-z0-9.]+[a-z0-9](/.*)?
// gcs"gs://bu/scio-contextual"
//     ^^^^^^^^^^^^^^^^^^^^^^^^
// error: invalid uri format: gs://[a-z0-9][-_a-z0-9.]+[a-z0-9](/.*)?
// gcs"gcs://bucket/scio-contextual"
//     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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.