-
Notifications
You must be signed in to change notification settings - Fork 78
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
FieldPath.from_string does not accept UUIDs #1012
Comments
My repro hits this code path in a Transaction. I haven't found a different way to repro.
Stack trace:
Really odd that this succeeds: |
Sanity check:
|
Thanks for the report It looks like part of this error makes sense: dashes aren't valid in FieldPaths, unless surrouned by backticks:
So it makes sense why But in your transaction code, you aren't trying to use FieldPaths directly, it seems like an internal call is building them. And I don't see any constraints on having field dashes in field names, only in path references. So it looks like the library is treating the field as a path, when it should be treated as a name directly. I'll take a look As a workaround, you could try adding backticks to your key: |
After looking at a number of places in the stack to make a fix, it seems like the simplest fix is to loosen the _LEADING_ALPHA_INVALID regex. I opened a PR, and added your code as a new test case |
The docs for FieldPath say
When I try using a UUID string (ex: a344a6ea-9911-40a8-bd99-00f0b8d61155) it fails with:
"Non-alphanum char in element with leading alpha: {}"
The regex used is at
python-firestore/google/cloud/firestore_v1/field_path.py
Line 34 in 995fad6
The text was updated successfully, but these errors were encountered: