public class MetastoreSchemaTool extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
MetastoreSchemaTool.CommandBuilder |
Modifier and Type | Field and Description |
---|---|
protected SchemaToolCommandLine |
cmdLine |
protected org.apache.hadoop.conf.Configuration |
conf |
protected String |
dbOpts |
protected String |
dbType |
protected String |
driver |
protected boolean |
dryRun |
protected String |
hiveDb |
protected String |
hivePasswd |
protected String |
hiveUser |
protected String |
metaDbType |
protected IMetaStoreSchemaInfo |
metaStoreSchemaInfo |
protected boolean |
needsQuotedIdentifier |
protected String |
passWord |
protected String |
quoteCharacter |
protected String |
url |
protected String |
userName |
protected URI[] |
validationServers |
protected boolean |
verbose |
Constructor and Description |
---|
MetastoreSchemaTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertCompatibleVersion(String hiveSchemaVersion,
String dbSchemaVersion) |
protected void |
execSql(String sqlScriptFile) |
protected void |
execSql(String scriptDir,
String scriptFile)
Execute a given metastore script.
|
protected static String |
findHomeDir() |
protected SchemaToolCommandLine |
getCmdLine() |
org.apache.hadoop.conf.Configuration |
getConf() |
protected HiveSchemaHelper.MetaStoreConnectionInfo |
getConnectionInfo(boolean printInfo) |
Connection |
getConnectionToMetastore(boolean printInfo) |
protected HiveSchemaHelper.NestedScriptParser |
getDbCommandParser(String dbType,
String metaDbType) |
protected String |
getDbType() |
protected String |
getHiveDb() |
protected String |
getHivePasswd() |
protected String |
getHiveUser() |
protected IMetaStoreSchemaInfo |
getMetaStoreSchemaInfo() |
protected URI[] |
getValidationServers() |
void |
init(String metastoreHome,
String[] args,
org.apache.commons.cli.OptionGroup additionalOptions,
org.apache.hadoop.conf.Configuration conf) |
protected boolean |
isDryRun() |
protected boolean |
isVerbose() |
static void |
main(String[] args) |
protected String |
quote(String stmt) |
int |
run(String[] args) |
int |
run(String metastoreHome,
String[] args,
org.apache.commons.cli.OptionGroup additionalOptions,
org.apache.hadoop.conf.Configuration conf) |
int |
runScript(String[] args,
InputStream scriptStream) |
protected void |
setDbOpts(String dbOpts) |
protected void |
setDriver(String driver) |
protected void |
setDryRun(boolean dryRun) |
protected void |
setHiveDb(String hiveDb) |
protected void |
setHivePasswd(String hivePasswd) |
protected void |
setHiveUser(String hiveUser) |
static void |
setHomeDirForTesting() |
void |
setPassWord(String passWord) |
protected void |
setUrl(String url) |
void |
setUserName(String userName) |
protected void |
setValidationServers(String servers) |
MetastoreSchemaTool |
setVerbose(boolean verbose) |
protected void |
testConnectionToMetastore() |
protected org.apache.hadoop.conf.Configuration conf
protected String dbOpts
protected String dbType
protected String driver
protected boolean dryRun
protected String hiveDb
protected String hivePasswd
protected String hiveUser
protected String metaDbType
protected IMetaStoreSchemaInfo metaStoreSchemaInfo
protected boolean needsQuotedIdentifier
protected String quoteCharacter
protected String passWord
protected String url
protected String userName
protected URI[] validationServers
protected boolean verbose
protected SchemaToolCommandLine cmdLine
protected static String findHomeDir()
public static void setHomeDirForTesting()
public void init(String metastoreHome, String[] args, org.apache.commons.cli.OptionGroup additionalOptions, org.apache.hadoop.conf.Configuration conf) throws HiveMetaException
HiveMetaException
public org.apache.hadoop.conf.Configuration getConf()
protected String getDbType()
protected void setUrl(String url)
protected void setDriver(String driver)
public void setUserName(String userName)
public void setPassWord(String passWord)
protected boolean isDryRun()
protected void setDryRun(boolean dryRun)
protected boolean isVerbose()
public MetastoreSchemaTool setVerbose(boolean verbose)
protected void setDbOpts(String dbOpts)
protected URI[] getValidationServers()
protected void setValidationServers(String servers)
protected String getHiveUser()
protected void setHiveUser(String hiveUser)
protected String getHivePasswd()
protected void setHivePasswd(String hivePasswd)
protected String getHiveDb()
protected void setHiveDb(String hiveDb)
protected SchemaToolCommandLine getCmdLine()
public Connection getConnectionToMetastore(boolean printInfo) throws HiveMetaException
HiveMetaException
protected HiveSchemaHelper.NestedScriptParser getDbCommandParser(String dbType, String metaDbType)
protected HiveSchemaHelper.MetaStoreConnectionInfo getConnectionInfo(boolean printInfo)
protected IMetaStoreSchemaInfo getMetaStoreSchemaInfo()
protected void assertCompatibleVersion(String hiveSchemaVersion, String dbSchemaVersion) throws HiveMetaException
HiveMetaException
protected void execSql(String scriptDir, String scriptFile) throws IOException, HiveMetaException
scriptDir
- directory script is inscriptFile
- file in the directory to runIOException
- if it cannot read the file or directoryHiveMetaException
- default implementation never throws thisprotected void execSql(String sqlScriptFile) throws IOException
IOException
protected void testConnectionToMetastore() throws HiveMetaException
HiveMetaException
public static void main(String[] args)
public int run(String[] args)
public final int runScript(String[] args, InputStream scriptStream)
Copyright © 2022 The Apache Software Foundation. All rights reserved.