Recent Pages

Commands at a glance
edittable: trivial tabl ...
indextable: generate ta ...
NoSQL Utilities
Text Formatting Rules
Site SandBox
Change Management
Wiki Editor's How-To
Site Terms of Use
Site Copyright


NoSQL Home
Table of Contents
Wiki Editor's How-To
Text Formatting Rules
Wiki SandBox on Twitter


Google Ads

Please Support NoSQL !


User ID

Campaigns petition banner

Modifying tables

I will now explain how NoSQL tables can be modified, both manually and with automated programs.

Basically there are two ways to manually modify an existing table: either direct editing with a TAB conscious text editor, like vi(1) or, better, by using the 'edittable' command. The latter method is recommended, especially in a multi-user environment where multiple concurrent editing sessions may occur against the same table file. Whatever editor is used also will need to preserve the SOH characters at the beginning of the table.

The 'edittable' utility can be used to add new rows and to change or delete existing rows of data in a table. The optional '--list' switch tells 'edittable' to convert the table to 'list' format for editing, which makes working with wide tables much more comfortable. The editor called by 'edittable' defaults to vi, or to whatever is set in the environment variable EDITOR.

After editing, the table is automatically checked for validity by 'edittable,' using 'istable.' If structure errors are detected, the program prompts you for what to do (re-edit, quit, etc.).

If you rather need to change a table from within a program, i.e. not interactively, you will have to stream-edit it, i.e.:

       operator < table

If you need to capture the resulting SDTOUT stream and write it back to a file, you must pay attention to avoid overwriting the original input file while it is being read. Some familiarity with the UNIX shell is expected from the user. For instance, you have better not do:

       operator < table > table

or you will end up with 'table' being zero'ed! Instead, the correct procedure is:

       operator < table > table.tmp
       mv table.tmp table

A better way to handle updates to a NoSQL table, especially when it needs to be done from within an application program, is to apply the methods described in section Big tables, even if the table being updated isn't big.

Trackbacks (1) | New trackback | Comments (0) | Print

This Web Site is Copyright © 2007,2008,2009,2010 Carlo Strozzi, Some Rights Reserved
site map | recent changes | terms of use