-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: general variable substitution #196
Conversation
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
fb93a40
to
8f19efb
Compare
Signed-off-by: Bugen Zhao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
sqllogictest/src/parser.rs
Outdated
/// Control whether or not to substitute variables in the SQL. | ||
Substitution(OnOff), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a simple bool
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then I'll make try_from_str
and as_str
a trait.
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: xxchan <[email protected]>
Support environment variables and special variables (like
$__TEST_DIR__
) substitution with the cratesubst
. Basically, this is a general form of the previousreplace_keywords
.This is helpful if we want to don't want to hardcode some information in the SQL, for example, authentication information.
See
substitution/basic.slt
for more detailed usages.In order to be compatible with other implementations, this feature is under the gate of
control substitution
and is by default disabled.