Reference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::Argument.
Argument
Input/output argument of a function or a stored procedure. See Routine.
Inherits
Object
Example
require"google/cloud/bigquery"bigquery=Google::Cloud::Bigquery.newdataset=bigquery.dataset"my_dataset"routine=dataset.create_routine"my_routine"do|r|r.routine_type="SCALAR_FUNCTION"r.language=:SQLr.body="(SELECT SUM(IF(elem.name = \"foo\",elem.val,null)) FROM UNNEST(arr) AS elem)"r.arguments=[Google::Cloud::Bigquery::Argument.new(name:"arr",argument_kind:"FIXED_TYPE",data_type:Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind:"ARRAY",array_element_type:Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind:"STRUCT",struct_type:Google::Cloud::Bigquery::StandardSql::StructType.new(fields:[Google::Cloud::Bigquery::StandardSql::Field.new(name:"name",type:Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind:"STRING")),Google::Cloud::Bigquery::StandardSql::Field.new(name:"val",type:Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind:"INT64"))]))))]end
Methods
#any_type?
defany_type?()->Boolean
Checks if the value of #argument_kind is ANY_TYPE. The default is false.
Returns
(Boolean) โ true when ANY_TYPE, false otherwise.
#argument_kind
defargument_kind()->String
The kind of argument. Optional. Defaults to FIXED_TYPE.
FIXED_TYPE - The argument is a variable with fully specified type, which can be a struct or an array, but
not a table.
ANY_TYPE - The argument is any type, including struct or array, but not a table.
To be added: FIXED_TABLE, ANY_TABLE.
Returns
(String) โ The upper case kind of argument.
#data_type
defdata_type()->StandardSql::DataType
The data type of the argument. Required unless #argument_kind is ANY_TYPE.
[[["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 2025-08-29 UTC."],[],[],null,["# BigQuery API - Class Google::Cloud::Bigquery::Argument (v1.55.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.55.0 (latest)](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument)\n- [1.54.0](/ruby/docs/reference/google-cloud-bigquery/1.54.0/Google-Cloud-Bigquery-Argument)\n- [1.53.0](/ruby/docs/reference/google-cloud-bigquery/1.53.0/Google-Cloud-Bigquery-Argument)\n- [1.52.1](/ruby/docs/reference/google-cloud-bigquery/1.52.1/Google-Cloud-Bigquery-Argument)\n- [1.51.1](/ruby/docs/reference/google-cloud-bigquery/1.51.1/Google-Cloud-Bigquery-Argument)\n- [1.50.0](/ruby/docs/reference/google-cloud-bigquery/1.50.0/Google-Cloud-Bigquery-Argument)\n- [1.49.1](/ruby/docs/reference/google-cloud-bigquery/1.49.1/Google-Cloud-Bigquery-Argument)\n- [1.48.1](/ruby/docs/reference/google-cloud-bigquery/1.48.1/Google-Cloud-Bigquery-Argument)\n- [1.47.0](/ruby/docs/reference/google-cloud-bigquery/1.47.0/Google-Cloud-Bigquery-Argument)\n- [1.46.1](/ruby/docs/reference/google-cloud-bigquery/1.46.1/Google-Cloud-Bigquery-Argument)\n- [1.45.0](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-Argument)\n- [1.44.2](/ruby/docs/reference/google-cloud-bigquery/1.44.2/Google-Cloud-Bigquery-Argument)\n- [1.43.1](/ruby/docs/reference/google-cloud-bigquery/1.43.1/Google-Cloud-Bigquery-Argument)\n- [1.42.0](/ruby/docs/reference/google-cloud-bigquery/1.42.0/Google-Cloud-Bigquery-Argument)\n- [1.41.0](/ruby/docs/reference/google-cloud-bigquery/1.41.0/Google-Cloud-Bigquery-Argument)\n- [1.40.0](/ruby/docs/reference/google-cloud-bigquery/1.40.0/Google-Cloud-Bigquery-Argument)\n- [1.39.0](/ruby/docs/reference/google-cloud-bigquery/1.39.0/Google-Cloud-Bigquery-Argument)\n- [1.38.1](/ruby/docs/reference/google-cloud-bigquery/1.38.1/Google-Cloud-Bigquery-Argument) \nReference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::Argument.\n\nArgument\n--------\n\nInput/output argument of a function or a stored procedure. See [Routine](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Routine \"Google::Cloud::Bigquery::Routine (class)\"). \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nbigquery = Google::Cloud::Bigquery.new\ndataset = bigquery.dataset \"my_dataset\"\nroutine = dataset.create_routine \"my_routine\" do |r|\n r.routine_type = \"SCALAR_FUNCTION\"\n r.language = :SQL\n r.body = \"(SELECT SUM(IF(elem.name = \\\"foo\\\",elem.val,null)) FROM UNNEST(arr) AS elem)\"\n r.arguments = [\n Google::Cloud::Bigquery::Argument.new(\n name: \"arr\",\n argument_kind: \"FIXED_TYPE\",\n data_type: Google::Cloud::Bigquery::StandardSql::DataType.new(\n type_kind: \"ARRAY\",\n array_element_type: Google::Cloud::Bigquery::StandardSql::DataType.new(\n type_kind: \"STRUCT\",\n struct_type: Google::Cloud::Bigquery::StandardSql::StructType.new(\n fields: [\n Google::Cloud::Bigquery::StandardSql::Field.new(\n name: \"name\",\n type: Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind: \"STRING\")\n ),\n Google::Cloud::Bigquery::StandardSql::Field.new(\n name: \"val\",\n type: Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind: \"INT64\")\n )\n ]\n )\n )\n )\n )\n ]\nend\n```\n\nMethods\n-------\n\n### #any_type?\n\n def any_type?() -\u003e Boolean\n\nChecks if the value of [#argument_kind](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_argument_kind_instance_ \"Google::Cloud::Bigquery::Argument#argument_kind (method)\") is `ANY_TYPE`. The default is `false`. \n**Returns**\n\n- (Boolean) --- `true` when `ANY_TYPE`, `false` otherwise.\n\n### #argument_kind\n\n def argument_kind() -\u003e String\n\nThe kind of argument. Optional. Defaults to `FIXED_TYPE`.\n\n\n- `FIXED_TYPE` - The argument is a variable with fully specified type, which can be a struct or an array, but not a table.\n- `ANY_TYPE` - The argument is any type, including struct or array, but not a table.\n\n\u003cbr /\u003e\n\nTo be added: `FIXED_TABLE`, `ANY_TABLE`. \n**Returns**\n\n- (String) --- The upper case kind of argument.\n\n### #data_type\n\n def data_type() -\u003e StandardSql::DataType\n\nThe data type of the argument. Required unless [#argument_kind](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_argument_kind_instance_ \"Google::Cloud::Bigquery::Argument#argument_kind (method)\") is `ANY_TYPE`. \n**Returns**\n\n- ([StandardSql::DataType](./Google-Cloud-Bigquery-StandardSql-DataType)) --- The data type.\n\n### #fixed_type?\n\n def fixed_type?() -\u003e Boolean\n\nChecks if the value of [#argument_kind](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_argument_kind_instance_ \"Google::Cloud::Bigquery::Argument#argument_kind (method)\") is `FIXED_TYPE`. The default is `true`. \n**Returns**\n\n- (Boolean) --- `true` when `FIXED_TYPE`, `false` otherwise.\n\n### #in?\n\n def in?() -\u003e Boolean\n\nChecks if the value of [#mode](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_mode_instance_ \"Google::Cloud::Bigquery::Argument#mode (method)\") is `IN`. Can be set for procedures only. The default is `false`. \n**Returns**\n\n- (Boolean) --- `true` when `IN`, `false` otherwise.\n\n### #initialize\n\n def initialize(data_type, kind, mode, name) -\u003e Argument\n\nCreates a new, immutable Argument object. \n**Overloads** \n\n def initialize(data_type, kind, mode, name) -\u003e Argument\n\nCreates a new, immutable Argument object. \n**Parameters**\n\n- **data_type** ([StandardSql::DataType](./Google-Cloud-Bigquery-StandardSql-DataType), String) --- The data type of the argument. Required unless [#argument_kind](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_argument_kind_instance_ \"Google::Cloud::Bigquery::Argument#argument_kind (method)\") is `ANY_TYPE`.\n- **argument_kind** (String) --- The kind of argument. Optional. Defaults to `FIXED_TYPE`.\n\n\n - `FIXED_TYPE` - The argument is a variable with fully specified type, which can be a struct or an array, but not a table.\n - `ANY_TYPE` - The argument is any type, including struct or array, but not a table.\n\n To be added: `FIXED_TABLE`, `ANY_TABLE`.\n- **mode** (String) ---\n\n Specifies whether the argument is input or output. Optional. Can be set for procedures\n only.\n - IN - The argument is input-only.\n - OUT - The argument is output-only.\n - INOUT - The argument is both an input and an output.\n- **name** (String) --- The name of the argument. Optional. Can be absent for a function return argument. \n**Returns**\n\n- ([Argument](./Google-Cloud-Bigquery-Argument)) --- a new instance of Argument\n\n### #inout?\n\n def inout?() -\u003e Boolean\n\nChecks if the value of [#mode](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_mode_instance_ \"Google::Cloud::Bigquery::Argument#mode (method)\") is `INOUT`. Can be set for procedures only. The default is `false`. \n**Returns**\n\n- (Boolean) --- `true` when `INOUT`, `false` otherwise.\n\n### #mode\n\n def mode() -\u003e String\n\nSpecifies whether the argument is input or output. Optional. Can be set for procedures only.\n\n- IN - The argument is input-only.\n- OUT - The argument is output-only.\n- INOUT - The argument is both an input and an output. \n**Returns**\n\n- (String) --- The upper case input/output mode of the argument.\n\n### #name\n\n def name() -\u003e String\n\nThe name of the argument. Optional. Can be absent for a function return argument. \n**Returns**\n\n- (String) --- The name of the argument.\n\n### #out?\n\n def out?() -\u003e Boolean\n\nChecks if the value of [#mode](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Argument#Google__Cloud__Bigquery__Argument_mode_instance_ \"Google::Cloud::Bigquery::Argument#mode (method)\") is `OUT`. Can be set for procedures only. The default is `false`. \n**Returns**\n\n- (Boolean) --- `true` when `OUT`, `false` otherwise."]]