ExAliyunOts.create_table

You're seeing just the function create_table, go back to ExAliyunOts module for more information.
Link to this function

create_table(instance, table_name, primary_keys, options \\ [])

View Source

Specs

create_table(instance(), table_name(), primary_keys(), options()) ::
  :ok | {:error, ExAliyunOts.Error.t()}

Official document in Chinese | English

Example

create_table "table_name2",
  [{"key1", :string}, {"key2", :auto_increment}]

create_table "table_name3",
  [{"key1", :string}],
  reserved_throughput_write: 1,
  reserved_throughput_read: 1,
  time_to_live: 100_000,
  max_versions: 3,
  deviation_cell_version_in_sec: 6_400,
  stream_spec: [is_enabled: true, expiration_time: 2]

create_table "table_name",
  [{"key1", :string}],
  defined_columns: [
    {"attr1", :string},
    {"attr2", :integer},
    {"attr3", :boolean},
    {"attr4", :double},
    {"attr5", :binary}
  ]

create_table "table_name",
  [{"key1", :string}],
  index_metas: [
    {"indexname1", ["key1"], ["attr1", "attr2"]},
    {"indexname2", ["key1"], ["attr4"]}
  ]

Options

  • :reserved_throughput_write, optional, the reserved throughput write of table, by default it is 0.
  • :reserved_throughput_read, optional, the reserved throughput read of table, by default it is 0.
  • time_to_live, optional, the data storage time to live in seconds, the minimum settable value is 864_000 seconds (one day), by default it is -1 (for permanent).
  • :max_versions, optional, the version of table, by default it is 1 that specifies there is only one version for columns.
  • :deviation_cell_version_in_sec, optional, maximum version deviation, by default it is 864_000 seconds (one day).
  • :stream_spec, specifies whether enable stream, by default it is not enable stream feature.
    • :is_enabled, enable or not enable stream, use true or false;
    • :expiration_time, the expiration time of stream.
  • :index_metas, optional, the index meta of table, each item of :index_metas is in {String.t(), list(), list()} format, by default it is [].
  • :defined_columns, optional, the indexed attribute column, which is a combination of predefined columns of the base table, each item of :defined_columns is in {String.t(), :integer | :double | :boolean | :string | :binary} format, by default it is [].