Method: Google::Cloud::Bigquery::Schema#float

Defined in:
lib/google/cloud/bigquery/schema.rb

#float(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object

Adds a floating-point number field to the schema.

Parameters:

  • name (String)

    The field name. The name must contain only letters ([A-Za-z]), numbers ([0-9]), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.

  • description (String) (defaults to: nil)

    A description of the field.

  • mode (Symbol) (defaults to: :nullable)

    The field's mode. The possible values are :nullable, :required, and :repeated. The default value is :nullable.

  • policy_tags (Array<String>, String) (defaults to: nil)

    The policy tag list or single policy tag for the field. Policy tag identifiers are of the form projects/*/locations/*/taxonomies/*/policyTags/*. At most 1 policy tag is currently allowed.

  • default_value_expression (String) (defaults to: nil)

    The default value of a field using a SQL expression. It can only be set for top level fields (columns). Use a struct or array expression to specify default value for the entire struct or array. The valid SQL expressions are:

    • Literals for all data types, including STRUCT and ARRAY.
    • The following functions: CURRENT_TIMESTAMP CURRENT_TIME CURRENT_DATE CURRENT_DATETIME GENERATE_UUID RAND SESSION_USER ST_GEOPOINT
    • Struct or array composed with the above allowed functions, for example: "[CURRENT_DATE(), DATE '2020-01-01'"]


403
404
405
406
407
408
409
410
# File 'lib/google/cloud/bigquery/schema.rb', line 403

def float name, description: nil, mode: :nullable,
          policy_tags: nil, default_value_expression: nil
  add_field name, :float,
            description: description,
            mode: mode,
            policy_tags: policy_tags,
            default_value_expression: default_value_expression
end