聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

Get DDL of a table in BigQuery

2021-10-22 10:31 浏览: 1936767 次 我要评论(0 条) 字号:

How could I conveniently get the creating-SQL of a table in BigQuery? We could use INFORMATION_SCHEMA:

SELECT
  table_name,
  ddl
FROM
  `data-to-insights.taxi.INFORMATION_SCHEMA.TABLES`
WHERE
  table_name="tlc_yellow_trips_2018_sample"

The result of ddl is:

CREATE TABLE `data-to-insights.taxi.tlc_yellow_trips_2018_sample`
(
  vendor_id STRING,
  pickup_datetime DATETIME,
  dropoff_datetime DATETIME,
  passenger_count INT64,
  trip_distance NUMERIC,
  rate_code STRING,
  store_and_fwd_flag STRING,
  payment_type STRING,
  fare_amount NUMERIC,
  extra NUMERIC,
  mta_tax NUMERIC,
  tip_amount NUMERIC,
  tolls_amount NUMERIC,
  imp_surcharge NUMERIC,
  total_amount NUMERIC,
  pickup_location_id STRING,
  dropoff_location_id STRING
);



网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复