Skip to content
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

Cherry Pick #32178: Loose BigQuery GCP project ID regex restrictions #32314

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,12 @@ public class BigQueryIO {
static final JsonFactory JSON_FACTORY = Transport.getJsonFactory();

/**
* Project IDs must contain 6-63 lowercase letters, digits, or dashes. IDs must start with a
* letter and may not end with a dash. This regex isn't exact - this allows for patterns that
* would be rejected by the service, but this is sufficient for basic parsing of table references.
* Formally, project IDs must contain 6-63 lowercase letters, digits, or dashes, must start with a
* letter and may not end with a dash. This regex is used for basic parsing of table references
* rather than validation purpose, e.g. it allows looser restriction for testing on mock
* resources. It may allow for patterns that would be rejected by the service
*/
private static final String PROJECT_ID_REGEXP = "[a-z][-a-z0-9:.]{4,61}[a-z0-9]";
private static final String PROJECT_ID_REGEXP = "[a-z][-a-z0-9:.]{0,61}[a-z0-9]";

/** Regular expression that matches Dataset IDs. */
private static final String DATASET_REGEXP = "[-\\w.]{1,1024}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public void testTableUrnParsing() {
public void testTableParsing_validPatterns() {
BigQueryHelpers.parseTableSpec("a123-456:foo_bar.d");
BigQueryHelpers.parseTableSpec("a12345:b.c");
BigQueryHelpers.parseTableSpec("a1:b.c");
BigQueryHelpers.parseTableSpec("b12345.c");
}

Expand Down
Loading