Package io.openlineage.client.utils
Class JdbcUtils
- java.lang.Object
-
- io.openlineage.client.utils.JdbcUtils
-
public class JdbcUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALPHANUMERIC
static java.lang.String
COLON_DELIMITER_USER_PASSWORD_REGEX
static java.lang.String
SLASH_DELIMITER_USER_PASSWORD_REGEX
-
Constructor Summary
Constructors Constructor Description JdbcUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DatasetIdentifier
getDatasetIdentifierFromJdbcUrl(java.lang.String jdbcUrl, java.lang.String name)
static DatasetIdentifier
getDatasetIdentifierFromJdbcUrl(java.lang.String jdbcUrl, java.util.List<java.lang.String> parts)
The algorithm for this method is as follows.static java.lang.String
sanitizeJdbcUrl(java.lang.String jdbcUrl)
JdbcUrl can contain username and password this method clean-up credentials from jdbcUrl and strip the jdbc prefix from the url
-
-
-
Field Detail
-
SLASH_DELIMITER_USER_PASSWORD_REGEX
public static final java.lang.String SLASH_DELIMITER_USER_PASSWORD_REGEX
- See Also:
- Constant Field Values
-
COLON_DELIMITER_USER_PASSWORD_REGEX
public static final java.lang.String COLON_DELIMITER_USER_PASSWORD_REGEX
- See Also:
- Constant Field Values
-
ALPHANUMERIC
public static final java.lang.String ALPHANUMERIC
- See Also:
- Constant Field Values
-
-
Method Detail
-
sanitizeJdbcUrl
public static java.lang.String sanitizeJdbcUrl(java.lang.String jdbcUrl)
JdbcUrl can contain username and password this method clean-up credentials from jdbcUrl and strip the jdbc prefix from the url- Parameters:
jdbcUrl
- url to database- Returns:
- String
-
getDatasetIdentifierFromJdbcUrl
public static DatasetIdentifier getDatasetIdentifierFromJdbcUrl(java.lang.String jdbcUrl, java.lang.String name)
-
getDatasetIdentifierFromJdbcUrl
public static DatasetIdentifier getDatasetIdentifierFromJdbcUrl(java.lang.String jdbcUrl, java.util.List<java.lang.String> parts)
The algorithm for this method is as follows. First we parse URI and check if it includes path part of URI. If yes, then we check if it contains database. Database is the first part after slash in URI - the "db" in something like postgres://host:5432/db. If it does contain it, and provided parts list has less than three elements, then we use it as database part of name - this indicates that database is the default one in this context. Otherwise, we take database from parts list.- Parameters:
jdbcUrl
- String URI we want to take dataset identifier fromparts
- Provided list of delimited parts of table qualified name parts. Can include database name.- Returns:
- DatasetIdentifier
-
-