> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# generic_record

> generic_record — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generic_record.rs#L1-L3422)&#x20;

Generic Record Support for Dynamic Type HandlingThis module provides `Type` and `GenericRecord` types for handling records without compile-time type information.

## Overview

`GenericRecord` is for cases where you need to work with records dynamically at runtime, without defining a specific struct:

<ul>
  <li>**[`Type`](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type)** - Immutable collection of metadata about a Kinetica type (schema, columns)</li>
  <li>**[`GenericRecord`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord)** - A record instance that stores values by column index</li>
</ul>

## When to Use GenericRecord

Use `GenericRecord` when:

<ul>
  <li>Table schema is not known at compile time</li>
  <li>You’re building generic data pipelines</li>
  <li>You need to copy data between tables with different schemas</li>
  <li>You’re reading data from CSV/JSON and inserting dynamically</li>
</ul>

Use statically-typed records (implementing `KineticaRecord`) when:

<ul>
  <li>Schema is known at compile time</li>
  <li>You want maximum type safety and performance</li>
  <li>You’re building application-specific data models</li>
</ul>

## Example

```rust theme={null}
use gpudb_api::{BulkInserter, GenericRecord, Kinetica, Type};
use std::sync::Arc;

// Fetch type from existing table
let record_type = Arc::new(Type::from_table(&kinetica, "my_table").await?);

// Or create type programmatically
let record_type = Type::builder("my_record")
    .add_int_column("id").primary_key()
    .add_string_column("name")
    .add_double_column("score")
    .build_arc()?;

// Create records, which share their type through the Arc
let mut record = record_type.new_record();
record.set(0, 42)?;                   // by index
record.set_by_name("name", "Alice")?; // by name
record.set_by_name("score", 95.5)?;

// Use with BulkInserter (requires schema string since GenericRecord can't implement Default)
let inserter = BulkInserter::<GenericRecord>::with_schema(
    kinetica,
    "my_table".to_string(),
    10000,  // batch_size
    8,      // num_workers
    None,   // options
    record_type.schema_string(),
).await?;
inserter.insert(Arc::new(record))?;
inserter.flush().await?;
```

## Structs

[Bulk<wbr />Insert<wbr />Stats](https://docs.kinetica.com/content/api/rust/generic_record/struct.BulkInsertStats.md)Statistics from a bulk insert operation.[Column](https://docs.kinetica.com/content/api/rust/generic_record/struct.Column.md)Immutable metadata about a column in a Kinetica type.[Generic<wbr />Record](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord.md)A generic record that can hold values for any Kinetica type.[Type](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type.md)Immutable collection of metadata about a Kinetica type.[Type<wbr />Builder](https://docs.kinetica.com/content/api/rust/generic_record/struct.TypeBuilder.md)Builder for constructing a Type with a fluent API.

## Enums

[Array<wbr />Value](https://docs.kinetica.com/content/api/rust/generic_record/enum.ArrayValue.md)The elements of an array or vector column, as [`GenericRecord::get_array`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord#method.get_array) gives them: an array of the element type, each element `None` where it is null, or a vector’s floats.[Column<wbr />Base<wbr />Type](https://docs.kinetica.com/content/api/rust/generic_record/enum.ColumnBaseType.md)Base column types (maps to Avro primitive types)[Column<wbr />Type](https://docs.kinetica.com/content/api/rust/generic_record/enum.ColumnType.md)Column types including subtypes determined by properties[Record<wbr />Value](https://docs.kinetica.com/content/api/rust/generic_record/enum.RecordValue.md)A typed value that can be stored in a GenericRecord.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.