Importing database elements using plain text

In addition to importing a complete database, Proximity lets you import individual containers and attributes using the plain text data format. To import additional data into an existing database, use the import-text.sh (import-text.bat for Windows) script to import a plain text data file containing the new data.

To import data into an existing database, all relevant files must be present in the same directory. To ensure that no unwanted data is imported, we recommend using a different directory for storing the required files for each import operation.

[Caution]

Recall that Proximity performs no error checking when importing plain text data. You are entirely responsible for ensuring the consistency and integrity of data imported using this format.

The following exercise walks through the process of importing a new attribute, birthyear, and its values into the existing MovieDB database.

Exercise 3.7. Importing an attribute using plain text data:

Before beginning, make sure that you are serving the MovieDB database (created in Exercise 3.6) using Mserver. You must have completed Exercise 3.6 before running the current exercise. Data files must be on the same machine as that serving the database.

  1. Uncompress the plain text data files.

    > cd $PROX_HOME/doc/user/tutorial/examples
    > gunzip movie_attr.tar.gz
    

    Uncompressing this tar file creates a MovieAttr directory under the $PROX_HOME/doc/user/tutorial/examples directory. All plain text data files required for the current import operation must be located in the same directory.

  2. Examine the files in the $PROX_HOME/doc/user/tutorial/examples/MovieAttr directory.

    Note that this directory contains two files:

    • attributes.data

    • O_attr_birthyear.data

    The attributes.data file defines the birthyearattribute that we want to import and the O_attr_birthyear.data file provides the values for this attribute. When importing selected database elements, you do not need to provide files for other types of data such as objects or links.

  3. Import the birthyear attribute data. (Substitute the appropriate port number if you are using a different port.)

    > bin/import-text.sh localhost:30000 $PROX_HOME/doc/user/tutorial/examples/MovieDB
    

    Data files must be on the same machine as that serving the database.

    During import, Proximity reports on the entities being defined (leading information showing elapsed time and execution thread has been omitted from the trace for brevity):

    INFO kdl.prox.app.ImportTextApp - * importing database from
       /proximity/doc/user/tutorial/examples/MovieAttr
    INFO kdl.prox.app.ImportTextApp -   Loading object table
    INFO kdl.prox.app.ImportTextApp -   Loading link table
    INFO kdl.prox.app.ImportTextApp -   Loading attributes
    INFO kdl.prox.app.ImportTextApp -   Loading attribute: O_attr_birthyear.data
    INFO kdl.prox.app.ImportTextApp -   Loading containers
    INFO kdl.prox.app.ImportTextApp - * done importing