Schema - Is it possible to fixe it?

schema

#1

Hello everyone,

InfluxDB is schema-less ok, but is there a way to make that schema fixed? Or should I forgive other data structure in my app ? Or (And I really don’t know if it is possible) should I implement inside InfluxDB a function that check this?

Kind regards,

Benjamin


#2

Hi Benjamin,

While it is schema less that doesn’t mean you cannot control it either. provided that you control what gets written in, you control the “virtual schema” your set of Tags and Fields will not change with time unless you add something new or stop providing something for a period of time then the “columns” would stay the same.

I might be wrong but if you start providing a different value type to a Fields it might create a new Field for it

Cheers,


#3

If you attempt to supply a different value type for an existing field – say if you start sending INTs to a field that was previously receiving FLOATs, the new values will be rejected. You cannot change the type of a value once it has been created.

Best Regards,
dg


#4

Hi everyone, first of all thank you for your quick answers. Well maybe I was not much clear about the context, but if a client connect itself on my database, and send, in my measurement (assuming I only have 1 measurement), a data structure completely different of the initial data I send, I assume there are not workaround on the fact to forget it. I did this test on a container on my laptop, and I could add anything I want.

Even if - and I get that - InfluxDB is schemaless (which is, in general, one of the NoSQL concept), I think it could nice, for some use case (maybe really specific) to add a parameter (conf file?) in which we allow a measurement to be totally schemaless, or not (default yes off course).

It was just a question to know if this possibility has been thought or not