Giter VIP home page Giter VIP logo

Comments (4)

yonromai avatar yonromai commented on August 17, 2024

👍

from scio.

nevillelyh avatar nevillelyh commented on August 17, 2024

http://blog.jetbrains.com/scala/2015/10/14/intellij-api-to-build-scala-macros-support/

It's not as straightforward as I thought since one will have to implement a custom injector like this:
https://github.com/JetBrains/intellij-scala/blob/idea16.x/src/org/jetbrains/plugins/scala/lang/psi/impl/toplevel/typedef/simulacrum/SimulacrumInjection.scala

from scio.

nevillelyh avatar nevillelyh commented on August 17, 2024

Right now the closest workaround, with #111, would be:

Make a query in the REPL, fetch result schema and get case class definitions with SchemaUtil.toPrettyString().

scio> val query = "SELECT repository.* FROM [bigquery-public-data:samples.github_nested] LIMIT 1000"
query: String = SELECT repository.* FROM [bigquery-public-data:samples.github_nested] LIMIT 1000

scio> val schema = bq.getTableSchema(bq.query(query))
...

scio> com.spotify.scio.bigquery.types.SchemaUtil.toPrettyString(schema, "Row", 0)
res1: String =
@BigQueryType.toTable
case class Row(repository: Option[Repository$])
case class Repository$(url: Option[String], has_downloads: Option[Boolean], created_at: Option[String], has_issues: Option[Boolean], description: Option[String], forks: Option[Int], fork: Option[Boolean], has_wiki: Option[Boolean], homepage: Option[String], integrate_branch: Option[String], master_branch: Option[String], size: Option[Int], private: Option[Boolean], name: Option[String], organization: Option[String], owner: Option[String], open_issues: Option[Int], watchers: Option[Int], pushed_at: Option[String], language: Option[String])

And then copy these case class definitions to the job code and use sc.typedBigQuery[Row](query).

from scio.

nevillelyh avatar nevillelyh commented on August 17, 2024

Documented in https://github.com/spotify/scio/wiki/BigQueryType-and-IntelliJ-IDEA
Doesn't look like it'll be fixed in IntelliJ any time soon so closing this for now.

from scio.

Related Issues (20)

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.