Exemplo n.º 1
0
# -s                             Phoenix schema name (mandatory if table is
#                                created without default phoenix schema name)
# -t                             Phoenix table name (mandatory)
# -sql                           Phoenix create table ddl path (mandatory)
# -zk                            Zookeeper IP:<port> (mandatory)
# -hd                            HDFS NameNode IP:<port> (mandatory)
# -mr                            MapReduce Job Tracker IP:<port> (mandatory)
# -o                             Output directory path in hdfs (optional)
# -idx                           Phoenix index table name (optional, index
#                                support is yet to be added)
# -error                         Ignore error while reading rows from CSV ?
#                                (1 - YES | 0 - NO, defaults to 1) (optional)
# -help                          Print all options (optional)

import os
import subprocess
import sys
import phoenix_utils

current_dir = os.path.dirname(os.path.abspath(__file__))
phoenix_jar_path = os.path.join(current_dir, "..", "phoenix-assembly",
                                "target")
phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar",
                                        phoenix_jar_path)

java_cmd = 'java -cp ".' + os.pathsep + phoenix_client_jar +\
    '" org.apache.phoenix.map.reduce.CSVBulkLoader ' +\
    ' '.join(sys.argv[1:])

subprocess.call(java_cmd, shell=True)
Exemplo n.º 2
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################

import os
import subprocess
import sys
import phoenix_utils

current_dir = os.path.dirname(os.path.abspath(__file__))
phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
                             os.path.join(current_dir, "..", "phoenix-assembly",
                                "target"))
phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)

if phoenix_client_jar == "":
    phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", os.path.join(current_dir, ".."))

if len(sys.argv) < 2:
    print "Zookeeper not specified. \nUsage: sqlline.py <zookeeper> \
<optional_sql_file> \nExample: \n 1. sqlline.py localhost:2181:/hbase \n 2. sqlline.py \
localhost:2181:/hbase ../examples/stock_symbol.sql"
    sys.exit()

sqlfile = ""

if len(sys.argv) > 2:
    sqlfile = "--run=" + sys.argv[2]
Exemplo n.º 3
0
# command line arguments
zookeeper = sys.argv[1]
rowcount = sys.argv[2]
table = "PERFORMANCE_" + sys.argv[2]

# helper variable and functions
ddl = "ddl.sql"
data = "data.csv"
qry = "query.sql"
statements = ""

current_dir = os.path.dirname(os.path.abspath(__file__))
phoenix_jar_path = os.getenv(
    'PHOENIX_LIB_DIR',
    os.path.join(current_dir, "..", "phoenix-assembly", "target"))
phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar",
                                        phoenix_jar_path)
phoenix_test_jar_path = os.getenv(
    'PHOENIX_LIB_DIR', os.path.join(current_dir, "..", "phoenix-core",
                                    "target"))
testjar = phoenix_utils.find("phoenix-*-tests.jar", phoenix_test_jar_path)

# HBase configuration folder path (where hbase-site.xml reside) for
# HBase/Phoenix client side property override
hbase_config_path = os.getenv('HBASE_CONF_DIR', current_dir)

execute = ('java -cp "%s%s%s" -Dlog4j.configuration=file:' +
           os.path.join(current_dir, "log4j.properties") +
           ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
    (hbase_config_path, os.pathsep, phoenix_client_jar, table, zookeeper)

# Create Table DDL
Exemplo n.º 4
0
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################

import os
import subprocess
import sys
import phoenix_utils

current_dir = os.path.dirname(os.path.abspath(__file__))
phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
                             os.path.join(current_dir, "..", "phoenix-assembly",
                                "target"))
phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)

# HBase configuration folder path (where hbase-site.xml reside) for
# HBase/Phoenix client side property override
java_cmd = 'java -cp ".' + os.pathsep + current_dir + os.pathsep + phoenix_client_jar + \
    '" -Dlog4j.configuration=file:' + \
    os.path.join(current_dir, "log4j.properties") + \
    " org.apache.phoenix.util.PhoenixRuntime " + ' '.join(sys.argv[1:])

subprocess.call(java_cmd, shell=True)
Exemplo n.º 5
0
# command line arguments
zookeeper = sys.argv[1]
rowcount = sys.argv[2]
table = "PERFORMANCE_" + sys.argv[2]

# helper variable and functions
ddl = "ddl.sql"
data = "data.csv"
qry = "query.sql"
statements = ""

current_dir = os.path.dirname(os.path.abspath(__file__))
phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
                             os.path.join(current_dir, "..", "phoenix-assembly",
                                "target"))
phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)
phoenix_test_jar_path = os.getenv('PHOENIX_LIB_DIR',
                                os.path.join(current_dir, "..", "phoenix-core",
                                     "target"))
testjar = phoenix_utils.find("phoenix-*-tests.jar", phoenix_test_jar_path)


# HBase configuration folder path (where hbase-site.xml reside) for
# HBase/Phoenix client side property override
hbase_config_path = os.getenv('HBASE_CONF_DIR', current_dir)

execute = ('java -cp "%s%s%s" -Dlog4j.configuration=file:' +
           os.path.join(current_dir, "log4j.properties") +
           ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
    (hbase_config_path, os.pathsep, phoenix_client_jar, table, zookeeper)