Send feedback
google-cloud-bigquery - Module Google::Cloud::Bigquery::External (v1.38.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version 1.38.1 keyboard_arrow_down
Reference documentation and code samples for the google-cloud-bigquery module Google::Cloud::Bigquery::External.
External
Creates a new DataSource (or subclass) object that
represents the external data source that can be queried from directly,
even though the data is not stored in BigQuery. Instead of loading or
streaming the data, this object references the external data source.
See DataSource , CsvSource ,
JsonSource , SheetsSource ,
BigtableSource
Examples
require "google / cloud / bigquery "
bigquery = Google :: Cloud :: Bigquery . new
csv_url = "gs : // bucket / path / to / data . csv "
csv_table = bigquery . external csv_url do | csv |
csv . autodetect = true
csv . skip_leading_rows = 1
end
data = bigquery . query "SELECT * FROM my_ext_table ",
external : { my_ext_table : csv_table }
# Iterate over the first page of results
data . each do | row |
puts row [ :name ]
end
# Retrieve the next page of results
data = data . next if data . next?
Hive partitioning options:
require "google / cloud / bigquery "
bigquery = Google :: Cloud :: Bigquery . new
gcs_uri = "gs : // cloud - samples - data / bigquery / hive - partitioning - samples / autolayout /* "
source_uri_prefix = "gs : // cloud - samples - data / bigquery / hive - partitioning - samples / autolayout / "
external_data = bigquery . external gcs_uri , format : :parquet do | ext |
ext . hive_partitioning_mode = :auto
ext . hive_partitioning_require_partition_filter = true
ext . hive_partitioning_source_uri_prefix = source_uri_prefix
end
external_data . hive_partitioning? #=> true
external_data . hive_partitioning_mode #=> "AUTO "
external_data . hive_partitioning_require_partition_filter? #=> true
external_data . hive_partitioning_source_uri_prefix #=> source_uri_prefix
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-19 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-09-19 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-19 UTC."]]