Skip to content

Commit

Permalink
namespaces: allow '+' in names (#2023)
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
  • Loading branch information
mobuchowski authored Jun 24, 2022
1 parent f1645f9 commit 2783f4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/src/main/java/marquez/common/models/NamespaceName.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public final class NamespaceName {
private static final int MIN_SIZE = 1;
private static final int MAX_SIZE = 1024;
private static final Pattern PATTERN =
Pattern.compile(String.format("^[a-zA-Z:;=/0-9_\\-\\.@]{%d,%d}$", MIN_SIZE, MAX_SIZE));
Pattern.compile(String.format("^[a-zA-Z:;=/0-9_\\-\\.@+]{%d,%d}$", MIN_SIZE, MAX_SIZE));

@Getter private final String value;

public NamespaceName(@NonNull final String value) {
checkArgument(
PATTERN.matcher(value).matches(),
"namespace '%s' must contain only letters (a-z, A-Z), numbers (0-9), "
+ "underscores (_), at (@), dashes (-), colons (:), equals (=), semicolons (;), slashes (/) "
+ "underscores (_), at (@), plus (+), dashes (-), colons (:), equals (=), semicolons (;), slashes (/) "
+ "or dots (.) with a maximum length of %s characters.",
value,
MAX_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/marquez/db/OpenLineageDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ default String getUrlOrNull(String uri) {
}

default String formatNamespaceName(String namespace) {
return namespace.replaceAll("[^a-z:/A-Z0-9\\-_.@]", "_");
return namespace.replaceAll("[^a-z:/A-Z0-9\\-_.@+]", "_");
}

default JobType getJobType(Job job) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class NamespaceNameTest {
"sqlserver://synapse-test-test001.sql.azuresynapse.net;databaseName=TESTPOOL1;",
"\u003D",
"@",
"abfss://something@.something-else.core.windows.net"
"abfss://something@.something-else.core.windows.net",
"databricks+connector://asdf-123456-7890.cloud.databricks.com"
})
void testValidNamespaceName(String name) {
assertThat(NamespaceName.of(name).getValue()).isEqualTo(name);
Expand Down

0 comments on commit 2783f4e

Please sign in to comment.