class Google::Cloud::Bigquery::External::CsvSource


data = data.next if data.next?
# Retrieve the next page of results
end
puts row[:name]
data.each do |row|
# Iterate over the first page of results
external: { my_ext_table: csv_table }
data = bigquery.query “SELECT * FROM my_ext_table”,
end
csv.skip_leading_rows = 1
csv.autodetect = true
csv_table = bigquery.external csv_url do |csv|
csv_url = “gs://bucket/path/to/data.csv”
bigquery = Google::Cloud::Bigquery.new
require “google/cloud/bigquery”
@example
the data, this object references the external data source.
the data is not stored in BigQuery. Instead of loading or streaming
directly, such as Google Cloud Storage or Google Drive, even though
represents a CSV external data source that can be queried from
{External::CsvSource} is a subclass of {External::DataSource} and
# CsvSource
#

def self.from_gapi gapi

Other tags:
    Private: - Google API Client object.
def self.from_gapi gapi
  new_table = super
  schema = Schema.from_gapi gapi.schema
  new_table.instance_variable_set :@schema, schema
  new_table
end

def delimiter

Returns:
  • (String) -
def delimiter
  @gapi.csv_options.field_delimiter
end

def delimiter= new_delimiter

Parameters:
  • new_delimiter (String) -- New delimiter value
def delimiter= new_delimiter
  frozen_check!
  @gapi.csv_options.field_delimiter = new_delimiter
end

def encoding

Returns:
  • (String) -
def encoding
  @gapi.csv_options.encoding
end

def encoding= new_encoding

Parameters:
  • new_encoding (String) -- New encoding value
def encoding= new_encoding
  frozen_check!
  @gapi.csv_options.encoding = new_encoding
end

def fields

Returns:
  • (Array) - An array of field objects.
def fields
  schema.fields
end

def headers

Returns:
  • (Array) - An array of column names.
def headers
  schema.headers
end

def initialize

Other tags:
    Private: - Create an empty CsvSource object.
def initialize
  super
  @gapi.csv_options = Google::Apis::BigqueryV2::CsvOptions.new
end

def iso8859_1?

Returns:
  • (Boolean) -
def iso8859_1?
  encoding == "ISO-8859-1"
end

def jagged_rows

Returns:
  • (Boolean) -
def jagged_rows
  @gapi.csv_options.allow_jagged_rows
end

def jagged_rows= new_jagged_rows

Parameters:
  • new_jagged_rows (Boolean) -- New jagged_rows value
def jagged_rows= new_jagged_rows
  frozen_check!
  @gapi.csv_options.allow_jagged_rows = new_jagged_rows
end

def null_marker

Returns:
  • (String, nil) - The null marker string. `nil` if not set.
def null_marker
  @gapi.csv_options.null_marker
end

def null_marker= null_marker

Parameters:
  • null_marker (String, nil) -- The null marker string. `nil` to unset.
def null_marker= null_marker
  frozen_check!
  @gapi.csv_options.null_marker = null_marker
end

def null_markers

Returns:
  • (Array) - The array of null marker strings.
def null_markers
  @gapi.csv_options.null_markers || []
end

def null_markers= null_markers

Parameters:
  • null_markers (Array) -- The array of null marker strings.
def null_markers= null_markers
  frozen_check!
  @gapi.csv_options.null_markers = null_markers
end

def param_types

Returns:
  • (Hash) - A hash with field names as keys, and types as values.
def param_types
  schema.param_types
end

def preserve_ascii_control_characters

Returns:
  • (Boolean, nil) - whether or not ASCII control characters are
def preserve_ascii_control_characters
  @gapi.csv_options.preserve_ascii_control_characters
end

def preserve_ascii_control_characters= val

Parameters:
  • val (Boolean, nil) -- whether or not ASCII control characters
def preserve_ascii_control_characters= val
  frozen_check!
  @gapi.csv_options.preserve_ascii_control_characters = val
end

def quote

Returns:
  • (String) -
def quote
  @gapi.csv_options.quote
end

def quote= new_quote

Parameters:
  • new_quote (String) -- New quote value
def quote= new_quote
  frozen_check!
  @gapi.csv_options.quote = new_quote
end

def quoted_newlines

Returns:
  • (Boolean) -
def quoted_newlines
  @gapi.csv_options.allow_quoted_newlines
end

def quoted_newlines= new_quoted_newlines

Parameters:
  • new_quoted_newlines (Boolean) -- New quoted_newlines value
def quoted_newlines= new_quoted_newlines
  frozen_check!
  @gapi.csv_options.allow_quoted_newlines = new_quoted_newlines
end

def schema replace: false

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

Other tags:
    Yieldparam: schema - the object accepting the schema

Other tags:
    Yield: - a block for setting the schema

Parameters:
  • replace (Boolean) -- Whether to replace the existing schema with
def schema replace: false
  @schema ||= Schema.from_gapi @gapi.schema
  if replace
    frozen_check!
    @schema = Schema.from_gapi
  end
  @schema.freeze if frozen?
  yield @schema if block_given?
  @schema
end

def schema= new_schema

Parameters:
  • new_schema (Schema) -- The schema object.
def schema= new_schema
  frozen_check!
  @schema = new_schema
end

def skip_leading_rows

Returns:
  • (Integer) -
def skip_leading_rows
  @gapi.csv_options.skip_leading_rows
end

def skip_leading_rows= row_count

Parameters:
  • row_count (Integer) -- New skip_leading_rows value
def skip_leading_rows= row_count
  frozen_check!
  @gapi.csv_options.skip_leading_rows = row_count
end

def source_column_match

Returns:
  • (String, nil) - The source column match value. `nil` if not set.
def source_column_match
  @gapi.csv_options.source_column_match
end

def source_column_match= source_column_match

Parameters:
  • source_column_match (String, nil) -- The new source column match value. `nil` to unset.
def source_column_match= source_column_match
  frozen_check!
  @gapi.csv_options.source_column_match = source_column_match
end

def to_gapi

Other tags:
    Private: - Google API Client object.
def to_gapi
  @gapi.schema = @schema.to_gapi if @schema
  @gapi
end

def utf8?

Returns:
  • (Boolean) -
def utf8?
  return true if encoding.nil?
  encoding == "UTF-8"
end