aiida-tutorials icon indicating copy to clipboard operation
aiida-tutorials copied to clipboard

✨ NEW: Explain `_` wildcard in querybuider section

Open chrisjsewell opened this issue 4 years ago • 1 comments

From @giovannipizzi Note for everyone: _ is a special character in like QueryBuilder queries. In like queries, we use SQL syntax: % means any character (like * in bash) and _ means a single character, like ? in bash. If you want to match a literal _, you need to escape it: 'like': r'tutorial\_%'. Note both the backslash, and the r in front of the string to avoid that python tries to interpret the backslash (other option, otherwise: 'like': 'tutorial\\_%'

this comes up in the new tutorial, because of the addition of the group paths

chrisjsewell avatar Jul 08 '20 16:07 chrisjsewell

Also, fix the query that we suggest here: https://aiida-tutorials.readthedocs.io/en/latest/pages/2020_Intro_Week/notebooks/querybuilder-tutorial.html#start-building-the-query (4.3.1.6.1) to use escaping, otherwise later the plot_results function will complain that there are more than 3 pseudo families

Probably anyway the simplest thing is to rename the groups in the export file with a dash instead of an underscore - or even better use directly slashes since we now have group paths, and explain those directly with the groups that already exist. In this way we don't need to make things more complex than needed by explaining the issue with _ and escaping

giovannipizzi avatar Jul 10 '20 07:07 giovannipizzi