Board: Bloomsbury Gardners Interface

Subject

Importing: progress and outstanding issues

Author

William Chesters

Status

Date

10/09/1999 06:37

Message

Features
========
Usage: java org.paneris.bloomsbury.gardners.Import <options> <file>
<file> import from the given Gardners' data file;
can be `books in print' or `books in stock'
<options> are:
--startPos <pos> where in the file to start: useful if a previous
run failed to run to completion (default 0)
--maxRecords <n> upload at most <n> records overall
(default all of them)
--blockSize <n> upload <n> book records at a time (default 10000)
--picciesDir <d> look in directory <d> for the subdirectories with the
the .JPG images Gardners provide in them (they're
called by two-hex-digit names; default the same
direcory as <file>)
--force run even though the program's idea of the structure
of the `books' table looks wrong (DANGEROUS!!)
--initial check that the `books' table is empty,
delete all its indices, upload from <file>, recreate
indices (don't use this if the web site is running)
--- It autodetects which kind of file you are giving it (BIP,
i.e. GARDNER1.AUG, or BIS, i.e. gardbib.dat) by looking at the first
two characters.
--- Because there are necessarily dependencies on the intimate
structure of the `books' table wired into the program, it checks to
see if the schema reported by postgres matches a sample set in the
source. If they are different, it won't run except with the --force
option.
--- It has two modes. By default, it runs in a way optimised for
the monthly case where we are uploading new Gardners data against an
only slightly obselete database. The (one-off?) case of a virgin
upload is handled by the --initial flag [except that it isn't fully
implemented yet; see below].
--- If an upload fails for any reason, the program tells you the
position in the file up to which it had COMMITed, so that you can
start again from there with the --offset option when you have sorted
things out. (There is a slight delay while it walks to your offset,
because, incredibly, Java implements InputStream.skip() as a series of
..read()s ... but it's nothing like as painful as starting from
scratch.)
Logic
=====
--- Books whose ISBNs are not already in the table get added,
whatever. Books whose ISBNs are in the table but not in the new data
file get marked deleted, but only if the data file is a BIP. Books
whose particulars are different in the new data get updated,
irrespective of which kind of data it is, unless they are marked
"touched" (a new DB field, see below). As a special case, the
universal absence of blurbs in BIS does not, however, cause all the
blurbs to be erased.
Change notice
=============
--- I have added a field called "touched" to the "books" table.
Only records marked as un-touched are overwritten by import records
with the same ISBN. (This just seemed more direct than messing about
with last-modified and so on.) However I haven't changed any SQL
scripts, since it wasn't immediately clear which ones were which.
[ --- Actually, it's probably not operational yet because I did an
ALTER TABLE ADD COLUMN followed by UPDATE books SET touched = false,
and so far that UPDATE has taken some hours ... :-) I think I'll
stop it and recreate the DB instead! ]
Outstanding issues
==================
--- No attempt has been made to resolve the questions raised by the
different standards of BIS as against BIP. I've made the categories
and publishers fields very messy, and everything imported from BIS is
still in upper case. As soon as a successful upload of BIS data is
performed, a lot of titles etc. will get uppercased.
--- Independently of BIS, there seem to be some different-case
duplications in the categories table, for instance.
--- The program has a switch for importing (from either sort of
Gardners file, BIP or BIS) into an empty "books" table. But it won't
automatically create the indices on that table when it has finished.
Should be easy to add. (In fact, it will recreate any that were there
when it started, but only if the whole upload run succeeds, which it
doesn't---see next item.)
--- Uploads from the big BIP file (GARDNER1.AUG) barf right at the
end on a whole lot of ^Zs ('

Bloomsbury Gardners Interface Board

 

Post Follow-up

Search This Board

 

Message Context:

Importing: progress and outstanding issues William Chesters 10/09/1999 06:37

    Re: Importing: progress and outstanding issues William Chesters (dai login) 10/09/1999 06:40



Home -  News -  Reference Sites -  Members -  Partners -  Guidelines -  Philosophy -  Your Details -  Logout