mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
This patch adds documentation and a small utility for users wishing to run the random query generator against Oracle as a reference database. In particular, the patch * points users toward installing Oracle Database. * provides directions on incorporating a Python Oracle client (cx_Oracle) into our impala-python virtual environment. * provides a small utility that will verify installation and connectivity between client and server This documentation isn't meant to be a complete guide. Other patches will add documentation for actually loading random query generator test data into Oracle, for example. Change-Id: Ib3bf84b7afa8851c49a8d0f0a1ceded94f4de158 Reviewed-on: http://gerrit.cloudera.org:8080/4095 Reviewed-by: Thomas Tauber-Marshall <tmarshall@cloudera.com> Reviewed-by: Matthew Jacobs <mj@cloudera.com> Tested-by: Matthew Jacobs <mj@cloudera.com>
64 lines
2.1 KiB
Python
Executable File
64 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env impala-python
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# 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.
|
|
|
|
# This is a script that allows a tester to test his Oracle setup and cx_Oracle
|
|
# installation within his impala-python environment. It's meant to be super simple. The
|
|
# emphasis here is on a cx_Oracle connection and cursor with no other distractions, even
|
|
# command line option parsing/handling. Modify the constants below and run:
|
|
#
|
|
# $ ./verify-oracle-connection.py
|
|
#
|
|
# If you get an exception, something is wrong. If cx_Oracle was able to make a
|
|
# connection to Oracle and run a simple query, you'll get a success message.
|
|
#
|
|
# Refer to ORACLE.txt for help.
|
|
|
|
# Importing the whole module instead of doing selective import seems to help find linker
|
|
# errors.
|
|
import cx_Oracle
|
|
|
|
# Host on which Oracle Database lies.
|
|
HOST = '127.0.0.1'
|
|
|
|
# The values below are default for the version of Oracle Database Express Edition
|
|
# tested. You may need to change these as needed:
|
|
PORT = 1521
|
|
SID = 'XE'
|
|
USER = 'system'
|
|
PASSWORD = 'oracle'
|
|
|
|
|
|
def main():
|
|
TEST_QUERY = 'SELECT 1 FROM DUAL'
|
|
EXPECTED_RESULT = [(1,)]
|
|
dsn = cx_Oracle.makedsn(HOST, PORT, SID)
|
|
with cx_Oracle.connect(user=USER, password=PASSWORD, dsn=dsn) as conn:
|
|
try:
|
|
cursor = conn.cursor()
|
|
query = cursor.execute(TEST_QUERY)
|
|
rows = query.fetchall()
|
|
finally:
|
|
cursor.close()
|
|
assert rows == EXPECTED_RESULT
|
|
print 'success'
|
|
|
|
|
|
if '__main__' == __name__:
|
|
main()
|