table cf create

Creates a column family for a MapR binary or JSON table.

Syntax

CLI
maprcli table cf create
 -path Table path 
 -cfname Column family name 
[ -minversions Min versions to keep. default: 0 ]
[ -maxversions Max versions to keep. default: 1 ]
[ -ttl Time to live. Enter 0 for forever. Otherwise enter time in seconds. default: 0 ]
[ -inmemory In-memory. default: false ]
[ -compression off|lzf|lz4|zlib. default: table's compression setting is applied. ]
[ -versionperm Version Permissions ]
[ -compressionperm Compression Permissions ]
[ -memoryperm Memory Permissions ]
[ -readperm Read Permissions ]
[ -writeperm Write Permissions ]
[ -appendperm Append Permissions ]
[ -jsonpath Json Family Path - needed for JSON column family, like a.b.c ]
[ -force Force create non-default column family for json tabletype. default: false ]
[ -traverseperm Traverse Permissions ]
REST
http[s]://<host>:<port>/rest/table/cf/create?path=<path>&cfname=<name>&<parameters>
NOTE: The mapr user is not treated as a superuser. MapR-DB does not allow the mapr user to run this command unless that user is given the relevant permission or permissions with access-control expressions.

Parameters

Parameter

Description

path

The path to the table.

  • For a path on the local cluster, start the path at the volume mount point. For example, for a table named test under volume1 which has a mount point at /volume1, specify the following path: /volume1/test
  • For a path on a remote cluster, you must also specify the cluster name in the path. For example, for a table named test under volume1 in the sanfrancisco cluster, specify the following path:/mapr/sanfrancisco/volume1/customer
cfname

The name of the column family to create.

minversions Applies to binary tables only: Minimum number of versions of column values to keep. The default is zero.
maxversions Applies to binary tables only: Maximum number of versions of column values to keep. The default is one.
ttl Time to live in seconds. The default value is forever. When the age of the data in this column family exceeds the value of the ttl parameter, the data is purged. Setting the value of ttl to 0 is equivalent to the default value of forever.
NOTE: If the value of -ttl for an existing column family in a JSON table is not 0, you cannot add another column family. See Setting TTL for Data in JSON Tables.
inmemory

Boolean. Determines whether preference is given to values of this column family for storage with row keys. Because row keys are cached in memory in preference to row data, column-family data that is stored inline with the row keys is also cached in memory.

For all column families in a table together, up to 200 bytes of row data will be stored inline with each row key. Storing data inline with a row key might speed retrieval of the data from a column family because disk access can often be avoided. For each column family, up to 32 bytes can be stored inline with each row key even if its inmemory parameter is set to false, but preference will be given to column families where this parameter is set to true. A column family can have more than 32 bytes stored inline if its inmemory parameter is set to true.

If the total number of bytes for all column families together exceeds 200 for a row, then preference for inclusion within the inline storage for that row is given to column families that have the inmemory parameter set to true.

NOTE: All of the data for a column family will be stored in-line with the row key, or none will be. If the contents in a column family for a particular row are larger than the maximum number of bytes that are allowed to be stored for that column family, no data at all will be stored in-line for that column family.

The default value for the inmemory parameter is false.

compression Applies to binary tables only: The compression setting to use for the column family. Valid options are off, lzf, lz4, and zlib. The default setting is equal to the table's compression setting. For more information, see Compression.
versionperm Applies to binary tables only: The Access Control Expression for changing the value of the maxversions and minversions parameters. By default, permission is given to the value of defaultversionperm for the table.
compressionperm Applies to binary tables only: The Access Control Expression for changing the value of the compression parameter. By default, permission is given to the value of defaultcompressionperm for the table.
memoryperm The Access Control Expression for changing the value of the inmemory parameter. Use single quotation marks around the ACE. By default, permission is given to the value of defaultmemoryperm for the table.
readperm

The Access Control Expression for column reads. Use single quotation marks around the ACE.

Reads require permission both at the column-family level and at the column level (for binary tables) or field level (for JSON tables). In JSON tables, this permission is inherited by fields within the column family.

By default, permission is given to the value of defaultreadperm for the table.

writeperm

The Access Control Expression for column writes (puts and deletes). Use single quotation marks around the ACE.

Writes require permission both at the column-family level and at the column level (for binary tables) or field level (for JSON tables). In JSON tables, this permission is inherited by fields within the column family.

By default, permission is given to the value of defaultwriteperm for the table.

appendperm

Applies to binary tables only: The Access Control Expression for column appends. Use single quotation marks around the ACE.

Column appends require permission both at the column-family level and at the column level. By default, permission is given to the value of defaultappendperm for the table.

jsonpath
Applies to JSON tables only: Specifies the path to the column family. The path is in dotted notation. For example, suppose the table contained JSON documents that were of this general structure:
{
     "_id" : "ID",
     "a" :
          {
               "b" : 
                    {
                         "c" : "value",
                    },
               "e" : "value"
          }
}
You want to create a column family at the field d in the new path a.b.d because you plan to store image files in fields in that column family.
IMPORTANT: Ensure that the field at which you want to create the column family does not yet exist. If the field does exist, it could become inaccessible after the column family is created.
force Applies to JSON tables only: By default, every time you try to create a non-default column family in a JSON table, this command fails and returns a warning message that you should ensure there is no existing data at the specified path. Set this parameter to true if you want to override this warning mechanism and create a column family.
traverseperm
Applies to JSON tables only: The Access Control Expressions that specifies who has permission to pass over fields in JSON documents. For example, suppose that a JSON table contains documents of this general structure:
{
     "_id" : "ID",
     "a" :
          {
               "b" : "value",
               "c" : "value"
          }
}
Suppose further that the user sjohnson has read permission on a.b, but not on a. For sjohnson to read a.b, the user needs the traverse permission on a. The user can then pass over field a to a.b.

This permission is inherited by fields within the column family. By default, this permission is given to the value of defaulttraverseperm for the JSON table.

Examples

Creating a new column family for a table, keeping four versions in memory
CLI
maprcli table cf create -path /volume1/mytable -cfname mynewcf -maxversions 4 -inmemory true
REST
https://r1n1.sj.us:8443/rest/table/cf/create?path=%2Fvolume1%2Fmytable&cfname=mynewcf&maxversions=4&inmemory=true