Giter Site home page Giter Site logo

Use sessions about bigrquery HOT 2 OPEN

hadley avatar hadley commented on June 11, 2024 2
Use sessions

from bigrquery.

Comments (2)

hadley avatar hadley commented on June 11, 2024

This is a bit more involved than I had hoped because temporary tables seem to be only part of the SQL API, not the REST api. So if we enable sessions, it'll mean switching implementations for many of the DBI methods and I don't have much sense of what the performance implications will be.

from bigrquery.

hadley avatar hadley commented on June 11, 2024

Since no one has actually asked for this, and it looks like it's going to be a decent amount of work I'll delay to the next release. If this issue sounds interesting to you, please thumbs up it!


What exactly does a temp table look like from the API? need to inspect result of job β€” can’t see anything obvious in the docs that give created table name. Can we get info from INFORMATION_SCHEMA.TABLES?

bq_perform_query() needs session argument β€” goes in connectionProperties field

  • Display in print method
  • Need to pass to resault
  • dbDisconnect() should terminate session, setting session to NULL
  • dbIsValid() should check session field
  • dbWriteTable needs call dbCreateTable() then dbAppendTable()
  • dbCreateTable() needs to call `sqlCreateTable() then execute it
  • dbAppendTable() needs to call sqlAppendTable() then execute it
  • dbReadTable() needs to switch to perform query? Otherwise need to figure out if the table is temporary, which might be available in INFORMATION_SCHEMA.
  • dbListTables needs to query INFORMATION_SCHEMA? Similarly with dbExistsTable. Need to see if temporary tables are even there.
  • dbRemoveTable() needs to use DROP TABLE;

Given that reading and writing table might have performance differences, it might be necessary to make this option, even if it's on by default.

To create a session:

bq_session_create <- function(project) {
  check_string(project)

  url <- bq_path(project, jobs = "")
  body <- list(
    configuration = list(
      query = list(
        query = "SELECT 1;",
        createSession = list(
          value = unbox(TRUE)
        )
      )
    )
  )

  res <- bq_post(url, body = bq_body(body))
  res$statistics$sessionInfo$sessionId
}

from bigrquery.

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.