Skip to content
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

Expand and document support for column names with special characters #2905

Merged
merged 5 commits into from
Feb 26, 2023

Conversation

joelostblom
Copy link
Contributor

@joelostblom joelostblom commented Feb 20, 2023

Continuing on some of the discussion in #2824. This issue has been raised a few times in the past so thought it was worth documenting and supporting slightly better:

Updated docs:

image

@mattijn
Copy link
Contributor

mattijn commented Feb 24, 2023

Its good to document this! I keep having the same question that I do not yet see answered. I know why special characters are not allowed when using:

shorthand='column_cannot_have_special_characters:Q'`

but are special characters allowed if one define it using field/type combination?

field='column_with_special_character', type='quantitative'

Eg. I found out that vl-convert cannot deal with the shorthand approach using a colon-datatype.

@joelostblom
Copy link
Contributor Author

joelostblom commented Feb 24, 2023

Good point, currently the long form with explicit type works for fields with a colon, but not with a period or bracket (they fail silently as they would in the shortform because the look for a nested attribute). Do you think I should update this PR so that colon raises an error in long form with explicit type too to make it consistent with how it is treated in shortform? Even if that limitation is "artifical".

It is too bad we cannot show an informative message when . or [] are used since they will "work" but look for nested attributes so they show an empty plot. That is #2825 again and probably needs to be fixed at the VL level.

@mattijn
Copy link
Contributor

mattijn commented Feb 26, 2023

I think the escaping of colons is a feature of using shorthand and should not become a feature of field.

Also I'm fine with the possibility of finding nested data using the brackets. I use this approach myself sometimes and is also used in VL here: https://vega.github.io/vega-lite/examples/facet_bullet.html and in Altair https://stackoverflow.com/a/55214346/2459096

@joelostblom
Copy link
Contributor Author

I think the escaping of colons is a feature of using shorthand and should not become a feature of field.

Agree. I added a note in the docs about them not having to be escaped in the long form.

Also I'm fine with the possibility of finding nested data using the brackets.

Yes, I also like having this, just wish it was immediately clear when this is happening, e.g. instead of showing an empty plot it would be great if VL outputed an error message along the lines of "No nested attribute found in the data" or similar. But nothing we can do about that here; this is good to merge from my side.

@mattijn mattijn merged commit 8a3c6b9 into master Feb 26, 2023
@mattijn mattijn deleted the more-support-for-special-chars branch August 25, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants