lindb / lindb

LinDB is a scalable, high performance, high availability distributed time series database.
https://lindb.io/
Apache License 2.0
3k stars 283 forks source link

[feature]: create table #1010

Open stone1100 opened 8 months ago

stone1100 commented 8 months ago

Is your feature request related to a problem? Please describe. Schema can be predefined by creating table statement.

create table ( host tag, region tag, cpu_load gauge, cpu_usage gauge )

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

joyant commented 8 months ago

Do you mean?

create table [if not exist] table_name 
(
    tag_definition [, tag_definition] ...
    field_definition [, field_definition] ...
)

tag_definition:
    tag_name tag

field_definition:
    field_name {min | max | first | last | sum}

For example:

create table if not exist cpu 
(
    host tag,
    ip tag,
    load last,
    temperature max
);
stone1100 commented 8 months ago

Yes. The current SQL parsing is not flexible. Currently parsing is being refactored, and this feature depends on #1015 .