Class: Google::Cloud::Bigquery::External::CsvSource
- Inherits:
-
DataSource
- Object
- DataSource
- Google::Cloud::Bigquery::External::CsvSource
- Defined in:
- lib/google/cloud/bigquery/external.rb
Overview
CsvSource
CsvSource is a subclass of DataSource and represents a CSV external data source that can be queried from directly, such as Google Cloud Storage or Google Drive, even though the data is not stored in BigQuery. Instead of loading or streaming the data, this object references the external data source.
Instance Method Summary collapse
-
#delimiter ⇒ String
The separator for fields in a CSV file.
-
#delimiter=(new_delimiter) ⇒ Object
Set the separator for fields in a CSV file.
-
#encoding ⇒ String
The character encoding of the data.
-
#encoding=(new_encoding) ⇒ Object
Set the character encoding of the data.
-
#fields ⇒ Object
The fields of the schema.
-
#headers ⇒ Object
The names of the columns in the schema.
-
#iso8859_1? ⇒ Boolean
Checks if the character encoding of the data is "ISO-8859-1".
-
#jagged_rows ⇒ Boolean
Indicates if BigQuery should accept rows that are missing trailing optional columns.
-
#jagged_rows=(new_jagged_rows) ⇒ Object
Set whether BigQuery should accept rows that are missing trailing optional columns.
-
#quote ⇒ String
The value that is used to quote data sections in a CSV file.
-
#quote=(new_quote) ⇒ Object
Set the value that is used to quote data sections in a CSV file.
-
#quoted_newlines ⇒ Boolean
Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file.
-
#quoted_newlines=(new_quoted_newlines) ⇒ Object
Set whether BigQuery should allow quoted data sections that contain newline characters in a CSV file.
-
#schema(replace: false) {|schema| ... } ⇒ Google::Cloud::Bigquery::Schema
The schema for the data.
-
#schema=(new_schema) ⇒ Object
Set the schema for the data.
-
#skip_leading_rows ⇒ Integer
The number of rows at the top of a CSV file that BigQuery will skip when reading the data.
-
#skip_leading_rows=(row_count) ⇒ Object
Set the number of rows at the top of a CSV file that BigQuery will skip when reading the data.
-
#utf8? ⇒ Boolean
Checks if the character encoding of the data is "UTF-8".
Methods inherited from DataSource
#autodetect, #autodetect=, #avro?, #backup?, #bigtable?, #compression, #compression=, #csv?, #format, #ignore_unknown, #ignore_unknown=, #json?, #max_bad_records, #max_bad_records=, #sheets?, #urls
Instance Method Details
#delimiter ⇒ String
The separator for fields in a CSV file.
795 796 797 |
# File 'lib/google/cloud/bigquery/external.rb', line 795 def delimiter @gapi..field_delimiter end |
#delimiter=(new_delimiter) ⇒ Object
Set the separator for fields in a CSV file.
816 817 818 819 |
# File 'lib/google/cloud/bigquery/external.rb', line 816 def delimiter= new_delimiter frozen_check! @gapi..field_delimiter = new_delimiter end |
#encoding ⇒ String
The character encoding of the data.
706 707 708 |
# File 'lib/google/cloud/bigquery/external.rb', line 706 def encoding @gapi..encoding end |
#encoding=(new_encoding) ⇒ Object
Set the character encoding of the data.
727 728 729 730 |
# File 'lib/google/cloud/bigquery/external.rb', line 727 def encoding= new_encoding frozen_check! @gapi..encoding = new_encoding end |
#fields ⇒ Object
The fields of the schema.
976 977 978 |
# File 'lib/google/cloud/bigquery/external.rb', line 976 def fields schema.fields end |
#headers ⇒ Object
The names of the columns in the schema.
983 984 985 |
# File 'lib/google/cloud/bigquery/external.rb', line 983 def headers schema.headers end |
#iso8859_1? ⇒ Boolean
Checks if the character encoding of the data is "ISO-8859-1".
774 775 776 |
# File 'lib/google/cloud/bigquery/external.rb', line 774 def iso8859_1? encoding == "ISO-8859-1" end |
#jagged_rows ⇒ Boolean
Indicates if BigQuery should accept rows that are missing trailing optional columns.
617 618 619 |
# File 'lib/google/cloud/bigquery/external.rb', line 617 def jagged_rows @gapi..allow_jagged_rows end |
#jagged_rows=(new_jagged_rows) ⇒ Object
Set whether BigQuery should accept rows that are missing trailing optional columns.
639 640 641 642 |
# File 'lib/google/cloud/bigquery/external.rb', line 639 def jagged_rows= new_jagged_rows frozen_check! @gapi..allow_jagged_rows = new_jagged_rows end |
#quote ⇒ String
The value that is used to quote data sections in a CSV file.
838 839 840 |
# File 'lib/google/cloud/bigquery/external.rb', line 838 def quote @gapi..quote end |
#quote=(new_quote) ⇒ Object
Set the value that is used to quote data sections in a CSV file.
859 860 861 862 |
# File 'lib/google/cloud/bigquery/external.rb', line 859 def quote= new_quote frozen_check! @gapi..quote = new_quote end |
#quoted_newlines ⇒ Boolean
Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file.
662 663 664 |
# File 'lib/google/cloud/bigquery/external.rb', line 662 def quoted_newlines @gapi..allow_quoted_newlines end |
#quoted_newlines=(new_quoted_newlines) ⇒ Object
Set whether BigQuery should allow quoted data sections that contain newline characters in a CSV file.
684 685 686 687 |
# File 'lib/google/cloud/bigquery/external.rb', line 684 def quoted_newlines= new_quoted_newlines frozen_check! @gapi..allow_quoted_newlines = new_quoted_newlines end |
#schema(replace: false) {|schema| ... } ⇒ Google::Cloud::Bigquery::Schema
The schema for the data.
936 937 938 939 940 941 942 943 944 945 |
# File 'lib/google/cloud/bigquery/external.rb', line 936 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 |
#schema=(new_schema) ⇒ Object
Set the schema for the data.
968 969 970 971 |
# File 'lib/google/cloud/bigquery/external.rb', line 968 def schema= new_schema frozen_check! @schema = new_schema end |
#skip_leading_rows ⇒ Integer
The number of rows at the top of a CSV file that BigQuery will skip when reading the data.
882 883 884 |
# File 'lib/google/cloud/bigquery/external.rb', line 882 def skip_leading_rows @gapi..skip_leading_rows end |
#skip_leading_rows=(row_count) ⇒ Object
Set the number of rows at the top of a CSV file that BigQuery will skip when reading the data.
904 905 906 907 |
# File 'lib/google/cloud/bigquery/external.rb', line 904 def skip_leading_rows= row_count frozen_check! @gapi..skip_leading_rows = row_count end |
#utf8? ⇒ Boolean
Checks if the character encoding of the data is "UTF-8". This is the default.
751 752 753 754 |
# File 'lib/google/cloud/bigquery/external.rb', line 751 def utf8? return true if encoding.nil? encoding == "UTF-8" end |