Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better support for parameterised queries in @BigQueryType.fromQuery #1431

Merged
merged 2 commits into from Oct 5, 2018

Conversation

@regadas
Copy link
Contributor

commented Oct 4, 2018

Fixes: #1078

@regadas regadas force-pushed the regadas:feature/1078 branch from b015c88 to d91d77c Oct 4, 2018

@codecov

This comment has been minimized.

Copy link

commented Oct 4, 2018

Codecov Report

❗️ No coverage uploaded for pull request base (master@353c952). Click here to learn what that means.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1431   +/-   ##
=========================================
  Coverage          ?   68.67%           
=========================================
  Files             ?      161           
  Lines             ?     5041           
  Branches          ?      293           
=========================================
  Hits              ?     3462           
  Misses            ?     1579           
  Partials          ?        0
Impacted Files Coverage Δ
...com/spotify/scio/bigquery/types/BigQueryType.scala 37.5% <ø> (ø)
...com/spotify/scio/bigquery/types/TypeProvider.scala 40% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 353c952...da4a1ad. Read the comment docs.

@jto

jto approved these changes Oct 5, 2018

@BigQueryType.fromQuery(
"SELECT word, word_count FROM `data-integration-test.partition_a.table_%s` LIMIT %d",
"$LATEST",
1)

This comment has been minimized.

Copy link
@jto

jto Oct 5, 2018

Member

Would be nice to have a test to check that

 @BigQueryType.fromQuery(
    "SELECT word, word_count FROM `data-integration-test.partition_a.table_%s` LIMIT %d",
    "$LATEST",
    "1")

would not compile

@jto

This comment has been minimized.

Copy link
Member

commented Oct 5, 2018

Looks really cool 👍


def tableImpl(c: blackbox.Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
import c.universe._

val args = extractStrings(c, "Missing table specification")
val query = args.head.asInstanceOf[String]

This comment has been minimized.

Copy link
@regadas

regadas Oct 5, 2018

Author Contributor

yeah this thing can be clean up as well

@@ -74,24 +77,49 @@ private[types] object TypeProvider {
}

def schemaImpl(c: blackbox.Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
val schemaString = extractStrings(c, "Missing schema").head
val schemaString = extractStrings(c, "Missing schema").head.asInstanceOf[String]

This comment has been minimized.

Copy link
@regadas

regadas Oct 5, 2018

Author Contributor

cleanup here as well

@regadas regadas merged commit 2511784 into spotify:master Oct 5, 2018

4 checks passed

ci/circleci: build_211 Your tests passed on CircleCI!
Details
ci/circleci: build_212 Your tests passed on CircleCI!
Details
codecov/patch No report found to compare against
Details
codecov/project No report found to compare against
Details

@regadas regadas deleted the regadas:feature/1078 branch Oct 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.