Class BigQueryDatabaseType
- java.lang.Object
-
- migratedb.core.internal.database.base.BaseDatabaseType
-
- migratedb.core.internal.database.bigquery.BigQueryDatabaseType
-
- All Implemented Interfaces:
DatabaseType
public class BigQueryDatabaseType extends BaseDatabaseType
-
-
Field Summary
-
Fields inherited from class migratedb.core.internal.database.base.BaseDatabaseType
APPLICATION_NAME, LOG
-
-
Constructor Summary
Constructors Constructor Description BigQueryDatabaseType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Database<?>createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory)Initializes the Database used by this Database Type.BaseParsercreateParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext)Initializes the Parser used by this Database Type.StringgetBackupDriverClass(String url, ClassLoader classLoader)Retrieves a second choice backup driver for a JDBC url, in case the one returned bygetDriverClassis not available.StringgetDriverClass(String url, ClassLoader classLoader)Get the driver class used to handle this JDBC url.PatterngetJDBCCredentialsPattern()A regex that identifies credentials in the JDBC URL, where they conform to a pattern specific to this database.StringgetName()intgetNullType()intgetPriority()When identifying database types, the priority with which this type will be used.booleanhandlesDatabaseProductNameAndVersion(String databaseProductName, String databaseProductVersion, Connection connection)This allows more fine-grained control over which DatabaseType handles which connection.booleanhandlesJDBCUrl(String url)Whether this database type should handle the given JDBC url.StringinstantiateClassExtendedErrorMessage()voidmodifyOverridingConnectionProps(Map<String,String> props)These will override anything set bysetDefaultConnectionPropsandsetConfigConnectionPropsand should only be used if neither of those can satisfy your requirement.-
Methods inherited from class migratedb.core.internal.database.base.BaseDatabaseType
alterConnectionAsNeeded, createDatabase, createExecutionStrategy, createSqlScriptExecutorFactory, createSqlScriptFactory, createTransactionalExecutionTemplate, detectPasswordRequiredByUrl, detectUserRequiredByUrl, externalAuthPropertiesRequired, getDefaultJDBCCredentialsPattern, getExternalAuthProperties, getSelectVersionOutput, modifyConfigConnectionProps, modifyDefaultConnectionProps, shutdownDatabase, toString
-
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceDatabaseType- Specified by:
getNamein classBaseDatabaseType- Returns:
- The human-readable name for this database.
-
getNullType
public int getNullType()
- Specified by:
getNullTypein interfaceDatabaseType- Specified by:
getNullTypein classBaseDatabaseType- Returns:
- The JDBC type used to represent
nullin prepared statements.
-
getPriority
public int getPriority()
Description copied from class:BaseDatabaseTypeWhen identifying database types, the priority with which this type will be used. High numbers indicate that this type will be used in preference to others.- Specified by:
getPriorityin interfaceDatabaseType- Overrides:
getPriorityin classBaseDatabaseType
-
getJDBCCredentialsPattern
public Pattern getJDBCCredentialsPattern()
Description copied from class:BaseDatabaseTypeA regex that identifies credentials in the JDBC URL, where they conform to a pattern specific to this database. The first captured group should represent the password text, so that it can be redacted if necessary.- Specified by:
getJDBCCredentialsPatternin interfaceDatabaseType- Overrides:
getJDBCCredentialsPatternin classBaseDatabaseType- Returns:
- The URL regex.
-
handlesJDBCUrl
public boolean handlesJDBCUrl(String url)
Description copied from class:BaseDatabaseTypeWhether this database type should handle the given JDBC url.- Specified by:
handlesJDBCUrlin interfaceDatabaseType- Specified by:
handlesJDBCUrlin classBaseDatabaseType- Parameters:
url- The JDBC url.- Returns:
trueif this handles the JDBC url,falseif not.
-
getDriverClass
public String getDriverClass(String url, ClassLoader classLoader)
Description copied from interface:DatabaseTypeGet the driver class used to handle this JDBC url. This will only be called ifmatchesJDBCUrlpreviously returnedtrue.- Specified by:
getDriverClassin interfaceDatabaseType- Specified by:
getDriverClassin classBaseDatabaseType- Parameters:
url- The JDBC url.classLoader- The classLoader to check for driver classes.- Returns:
- The full driver class name to be instantiated to handle this url.
-
getBackupDriverClass
public String getBackupDriverClass(String url, ClassLoader classLoader)
Description copied from class:BaseDatabaseTypeRetrieves a second choice backup driver for a JDBC url, in case the one returned bygetDriverClassis not available.- Specified by:
getBackupDriverClassin interfaceDatabaseType- Overrides:
getBackupDriverClassin classBaseDatabaseType- Parameters:
url- The JDBC url.classLoader- The classLoader to check for driver classes.- Returns:
- The JDBC driver class name,
nullif none.
-
handlesDatabaseProductNameAndVersion
public boolean handlesDatabaseProductNameAndVersion(String databaseProductName, String databaseProductVersion, Connection connection)
Description copied from class:BaseDatabaseTypeThis allows more fine-grained control over which DatabaseType handles which connection. MigrateDB will use the first DatabaseType that returns true for this method.- Specified by:
handlesDatabaseProductNameAndVersionin interfaceDatabaseType- Specified by:
handlesDatabaseProductNameAndVersionin classBaseDatabaseType- Parameters:
databaseProductName- The product name returned by the database.databaseProductVersion- The product version returned by the database.connection- The connection used to connect to the database.- Returns:
trueif this handles the product name and version,falseif not.
-
modifyOverridingConnectionProps
public void modifyOverridingConnectionProps(Map<String,String> props)
Description copied from class:BaseDatabaseTypeThese will override anything set bysetDefaultConnectionPropsandsetConfigConnectionPropsand should only be used if neither of those can satisfy your requirement.- Specified by:
modifyOverridingConnectionPropsin interfaceDatabaseType- Overrides:
modifyOverridingConnectionPropsin classBaseDatabaseType- Parameters:
props- The properties to write to.
-
createDatabase
public Database<?> createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory)
Description copied from interface:DatabaseTypeInitializes the Database used by this Database Type.- Specified by:
createDatabasein interfaceDatabaseType- Specified by:
createDatabasein classBaseDatabaseType- Parameters:
configuration- The MigrateDB configuration.jdbcConnectionFactory- The current connection factory.- Returns:
- The Database.
-
createParser
public BaseParser createParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext)
Description copied from interface:DatabaseTypeInitializes the Parser used by this Database Type.- Specified by:
createParserin interfaceDatabaseType- Specified by:
createParserin classBaseDatabaseType- Parameters:
configuration- The MigrateDB configuration.- Returns:
- The Parser.
-
instantiateClassExtendedErrorMessage
public String instantiateClassExtendedErrorMessage()
- Specified by:
instantiateClassExtendedErrorMessagein interfaceDatabaseType- Overrides:
instantiateClassExtendedErrorMessagein classBaseDatabaseType- Returns:
- A hint on the requirements for creating database instances (libs on class path, etc.)
-
-