Skip to content

How to get column options #92

@nook24

Description

@nook24

Hallo,
this is a follow up of my series #75 and #84.

I try to read the following table definition using DBAL:

CREATE TABLE statusengine_logentries (
    logentry_time timestamp,
    entry_time timestamp,
    logentry_type int,
    logentry_data string,
    node_name string,
    day as date_trunc('day', logentry_time * 1000)
) CLUSTERED INTO 4 shards partitioned by (day) with (number_of_replicas = '0');

My issue is to read the day column with all options. I didn't find any method to read the as date_trunc('day', logentry_time * 1000) part of the column definition.

Thats my code:

$connectionParams = [
    'user'        => null,
    'password'    => null,
    'host'        => '127.0.0.1',
    'port'        => 4200,
    'driverClass' => 'Crate\DBAL\Driver\PDOCrate\Driver',
];
$connection = DriverManager::getConnection($connectionParams);
$platform = $connection->getDatabasePlatform();

$SchemaManager = $connection->getSchemaManager();

$schema = $SchemaManager->createSchema();

foreach ($schema->getTables() as $table) {
    foreach ($table->getColumns() as $column) {
        print_r($column->getCustomSchemaOptions()); //empty array
        print_r($column->getPlatformOptions()); //empty array
    }
}

I used crate-dbal 2.3.0 and CrateDB 4.1.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions