Open Glupschauge opened 5 years ago
This is somewhat related to the limited support of PARTITION BY RANGE (#178), but it's probably (easily) doable by adding a check when diffing tables.
Now that I started researching this issue, and in particular the ALTER TABLE
statement, I cannot find a clause to remove a PARTITION BY
specification (or for that matter, a clause to add one). So it appears that the only behavior that yamltodb
could implement is:
DROP TABLE sch.measurement;
CREATE TABLE sch.measurement (...);
Is that what you want? It seems to me that this opens a whole can of worms because in a realistic production scenario, table measurement
(with a PARTITION BY
spec) wouldn't just exist by itself, but would have various partitions, so perhaps they would first have to be DETACH
ed, and then? What happens with the data in those partitions? And of course, there's the converse scenario: the table is not partitioned in the database, but the input YAML says it is.
When comparing following schemas, "PARTITION BY" is not recognized as a diff if it is added to an already existing table.
schema a:
CREATE TABLE measurement ( city_id int not null, logdate date not null, peaktemp int, unitsales int );
schema b:
CREATE TABLE measurement ( city_id int not null, logdate date not null, peaktemp int, unitsales int ) PARTITION BY RANGE (logdate);
Following commands shows no difference.
dbtoyaml schema_a -o schema_a.yaml
yamltodb schema_b schema_a.yaml
I know this is a special case, however I would be grateful if this problem could be fixed.