-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add-dataset: Schema violation due to exceeding a limit of 30 characters #873
Comments
This isn't really a Kart bug: some other software (I think QGIS) has done something ill-advised, and Kart is not allowing it. The layer_styles table that QGIS has created has the following schema (ommitting some unimportant bits) One reason for Kart's strictness is because Kart also supports other working copy types - eg Postgresql - which are similarly strict, all values have to conform to the table's schema. So by having Kart enforce these checks then schema violations will be caught sooner (at the time of data import) rather than later (ie, at the time somebody tries to check out a Kart repository into a Postgresql database). I'm not sure what the proper fix here should be or whose software it should be applied to. Here are two workarounds:
|
Oh, or, as you say, truncating the styleName to be shorter would probably work too and would be simpler. Here's the SQL code for that:
Let me know if you need any help manually making edits in sqlite |
Hi! Thanks for the detailed answer and your help :) I ended up making the layername shorter before generating the style table and everything works correctly. It was easier for me than manually editing the table. I wonder if it would be worth pointing this out to the QGIS people? i.e. if they could add some sort of check that it either automatically truncates layernames longer than 30 chars, or that it would modify the max length of the field. |
I think you can also do (assuming it's not a foreign key/etc) ALTER TABLE layer_styles ADD COLUMN styleName2 TEXT;
UPDATE layer_styles SET styleName2 = styleName;
ALTER TABLE layer_styles DROP COLUMN styleName;
ALTER TABLE layer_styles RENAME COLUMN styleName2 TO styleName; |
Describe the bug
I was trying to make kart aware of the layer_styles table present in my geopackage. The table is created through the "Save as default in the source database" prompt in QGIS. This interaction automatically assign the layer name to the styleName column of the layer_styles table.
However, when importing the dataset through
kart add-dataset layer_styles
I get a schema violation error saying that the name if the style cannot exceed 30 character (see below).Due to some unknown reasons, there is no way for me to edit this table, as I cannot see the layer_styles in the database view of QGIS, so I cannot change the name of the styles manually.
To Reproduce
Steps to reproduce the behaviour:
kart status --list-untracked-tables
should show a layer_styles tablekart add-dataset layer_styles
and you will get the 30 characters limit error.Reproducible repo with layer_styles table present but not tracked.
Expected behaviour
I think I should be able to track the table even if the name of the styles is longer than 30 characters?
I don't know why I cannot see the layer_styles table in QGIS, but it might be a small bug of a previous version of the qgis plugin, as with the reproducible example above I am able to see it.
Output
When importing the dataset through
kart add-dataset layer_styles
, I get the following:Version Info
The text was updated successfully, but these errors were encountered: