module Google::Cloud::Bigquery

def self.configure

Returns:
  • (Google::Cloud::Config) - The configuration object the
def self.configure
  yield Google::Cloud.configure.bigquery if block_given?
  Google::Cloud.configure.bigquery
end

def self.default_credentials scope: nil

Other tags:
    Private: - Default credentials.
def self.default_credentials scope: nil
  Google::Cloud.configure.bigquery.credentials ||
    Google::Cloud.configure.credentials ||
    Bigquery::Credentials.default(scope: scope)
end

def self.default_project_id

Other tags:
    Private: - Default project.
def self.default_project_id
  Google::Cloud.configure.bigquery.project_id ||
    Google::Cloud.configure.project_id ||
    Google::Cloud.env.project_id
end

def self.new project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, endpoint: nil,

Returns:
  • (Google::Cloud::Bigquery::Project) -

Parameters:
  • keyfile (String) -- Alias for the `credentials` argument.
  • project (String) -- Alias for the `project_id` argument. Deprecated.
  • endpoint (String) -- Override of the endpoint host name. Optional.
  • timeout (Integer) -- Default timeout to use in requests. Optional.
  • retries (Integer) -- Number of times to retry requests on server
  • scope (String, Array) -- The OAuth 2.0 scopes controlling
  • credentials (String, Hash, Google::Auth::Credentials) -- The path to
  • project_id (String) -- Identifier for a BigQuery project. If not
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, endpoint: nil,
             project: nil, keyfile: nil, universe_domain: nil
  scope       ||= configure.scope
  retries     ||= configure.retries
  timeout     ||= configure.timeout
  endpoint    ||= configure.endpoint
  credentials ||= keyfile || default_credentials(scope: scope)
  universe_domain ||= configure.universe_domain
  unless credentials.is_a? Google::Auth::Credentials
    credentials = Bigquery::Credentials.new credentials, scope: scope
  end
  project_id = resolve_project_id(project_id || project, credentials)
  raise ArgumentError, "project_id is missing" if project_id.empty?
  Bigquery::Project.new(
    Bigquery::Service.new(
      project_id, credentials,
      retries: retries, timeout: timeout, host: endpoint,
      quota_project: configure.quota_project, universe_domain: universe_domain
    )
  )
end

def self.resolve_project_id given_project, credentials

Other tags:
    Private: - Resolve project.
def self.resolve_project_id given_project, credentials
  project_id = given_project || default_project_id
  project_id ||= credentials.project_id if credentials.respond_to? :project_id
  project_id.to_s # Always cast to a string
end