-
Notifications
You must be signed in to change notification settings - Fork 3
escape field names in relation mappings when necessary #113
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
escape field names in relation mappings when necessary #113
Conversation
#[tokio::test] | ||
async fn filters_by_field_nested_in_object_in_related_collection() -> Result<(), anyhow::Error> |
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.
I found this ancient, forgotten test so I uncommented it.
// If there is a single column mapping, and the source and target field references can be | ||
// expressed as match keys (we don't need to escape field names), then we can use a concise | ||
// correlated subquery. Otherwise we need to fall back to an uncorrelated subquery. | ||
let safe_single_column_mapping = if column_mapping.len() == 1 { |
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.
The meat of the changes starts here
…f-safe_name-to-produce-lookup-stages
…f-safe_name-to-produce-lookup-stages
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!
crates/integration-tests/src/lib.rs
Outdated
@@ -35,6 +36,12 @@ fn get_connector_chinook_url() -> anyhow::Result<Url> { | |||
Ok(url) | |||
} | |||
|
|||
fn get_connector_test_cases_url() -> anyhow::Result<Url> { | |||
let input = env::var(CONNECTOR_TEST_CASES_URL).map_err(|_| anyhow!("please set {CONNECTOR_TEST_CASES_URL} to the the base URL of a running MongoDB connector instance"))?; |
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.
let input = env::var(CONNECTOR_TEST_CASES_URL).map_err(|_| anyhow!("please set {CONNECTOR_TEST_CASES_URL} to the the base URL of a running MongoDB connector instance"))?; | |
let input = env::var(CONNECTOR_TEST_CASES_URL).map_err(|_| anyhow!("please set {CONNECTOR_TEST_CASES_URL} to the base URL of a running MongoDB connector instance"))?; |
Previously on attempts to join on field names that require escaping the request would fail with an error saying that a name was not valid. This change does the necessary escaping to make the join work.
This is the last change that was needed to get rid of
safe_name
which was the quick-and-easy fail-on-problematic-names solution that we used early on.