This is a clever mechanism. I'm wondering if it's too clever though. Executing this code at compile-time is rather limiting and may confuse users. WDYT about having an annotation that specifies a config path? I'm not sure what is the current state of 'enclosing' trees in the macros API. We'd need to search from the macro expansion point outwards until we find such an annotation, falling back to a default path if none is there. In the common case of using only one single database, you wouldn't need to do anything in your code. You'd only have to use the annotation if you want different statements to be checked against different databases.