Loading the Larger Sample Data Set into the Historical Database

Running the queries against the sample data loaded during installation returns limited results, so you may want to load a larger set of data into the Sybase IQ database.

Prerequisites

Install Sybase IQ client tools or run the queries from the Sybase IQ server installation's tools. See Sybase IQ Installation Guide>Client Installations for your platform.

The files STOCK_QUOTE.csv, STOCK_TRADE.csv, and STOCK_HISTORY.csv contain a subset of the data in the STOCK_QUOTE.zip, STOCK_TRADE.zip, and STOCK_HISTORY.zip files. To preserve the smaller STOCK_QUOTE.csv, STOCK_TRADE.csv, and STOCK_HISTORY.csv files, rename these files before you extract the zipped versions of the files.

Task

If you load the larger sample data set into RAP, the small TAQ sample data will be lost. To preserve the small sample data set, follow the steps in Preserving the Small TAQ Sample Data Set in the Historical Database.

  1. Extract the STOCK_QUOTE.zip, STOCK_TRADE.zip, and STOCK_HISTORY.zip files located in the <RAP Enablement Installation Directory>/databases/iq/data/marketdata directory back into this directory.
  2. On the machine that hosts the Sybase IQ database, change to the <Sybase IQ Installation Directory>.
  3. Source the environment variables source IQ.csh or . IQ.sh.
  4. Run the configure.sh script in the RAP enablement package directory if you have not already done so.
  5. Change to <RAP Enablement Installation Directory>/databases/iq/scripts.
  6. If you unzipped the files to another directory, edit the load_TAQ_tables.sql file to specify the location of the unzipped STOCK_QUOTE.csv and STOCK_TRADE.csv files.
  7. (Optional) Load the larger set of sample data into the STOCK_HISTORY table by editing the load_TAQ_tables.sql file.
    Append the following lines, replacing <RAP Emablement Installation Directory> with the path name of your RAP enablement package:
    truncate table RAP_USER.STOCK_HISTORY;
    commit;
    load table RAP_USER.STOCK_HISTORY
    (
    INSTRUMENT_ID    null (blanks,'NULL') ,
    TRADE_DATE    null (blanks,'NULL') ,
    TRADING_SYMBOL null (blanks,'NULL') ,
    OPEN_PRICE    null (blanks,'NULL') ,
    CLOSE_PRICE    null (blanks,'NULL') ,
    LOW_PRICE    null (blanks,'NULL') ,
    HIGH_PRICE    null (blanks,'NULL') ,
    VOLUME        '\x0a'
    )
    from '<RAP Enablement Installation Directory>/databases/iq/data/marketdata/STOCK_HISTORY.csv'
    quotes off
    escapes off
    preview on;
    commit;
    Note: If you do not load the STOCK_HISTORY table with this additional sample data, some of the historical market data sample queries return no results.
  8. Use Interactive SQL (dbisql) to log in to the Sybase IQ database.
  9. Run the load_TAQ_tables.sql script.

    This script truncates existing data and loads the larger set of TAQ sample data into the Sybase IQ database.

Next

Check the status of the sample data load by reviewing the log file for the Sybase IQ database, database_name.iqmsg. The default location of the log file is the directory where the Sybase IQ database file (database_name.db) is located.