Class GPUdbRecordType

class gpudb.GPUdbRecordType(columns=None, label='', schema_string=None, column_properties=None)[source]

Bases: object

Represent the data type for a given record in GPUdb. Has convenience functions for creating the type in GPUdb (among others).

Create a GPUdbRecordType object which represents the data type for a given record for GPUdb.

Parameters

columns (list) –
A list of GPUdbRecordColumn objects. Either this argument or the schema_string argument must be given.
label (str) –
Optional string label for the column.
schema_string (str) –
The JSON string containing the schema for the type. Either this argument or the columns argument must be given.
column_properties (dict) –
Optional dict that lists the properties for the columns of the type. Meant to be used in conjunction with schema_string only; will be ignored if columns is given.
columns

A list of columns for the record type.

column_names

A list of the names of the columns for the record type.

label

A label for the record type.

schema_string

The schema string for the record type.

record_schema

The avro schema for the record type.

record_type

The RecordType object for the record type.

column_properties

The properties for the type’s columns.

type_id

The ID for the type, if it has already been registered with GPUdb.

create_type(gpudb, options=None)[source]

Create the record type in GPUdb so that users can create tables using this type.

Parameters

gpudb (GPUdb) –
A GPUdb object to connect to a GPUdb server.
option (dict) –
Optional dictionary containing options for the /create/type call.

Returns

The type ID.
get_column(column_id)[source]

Return the desired columnd; fetch by name or index.

Parameters

column_id (str or int) –
If string, then the name of the column. If an integer, then the index of the column. Must be a valid column name or be within bounds.

Returns

The GPUdbRecordColumn object pertaining to the desired column.