AutoSql

From genomewiki
Revision as of 00:57, 8 April 2006 by AngieHinrichs (talk | contribs)
Jump to navigationJump to search

Jim Kent wrote autoSql and has documented it in the source (kent/src/hg/lib/autoSql/autoSql.doc) and in a Linux Journal article.

Our typical usage of autoSql is this:

  • write a .as file that describes a new (type of) table. This almost always goes in kent/src/hg/lib/ but .as files exist in other parts of the tree. Exceptions are becoming more common as new non-genomic, self-contained databases (e.g. uniProt, visiGene) are added.
  • run autoSql on the .as file to produce a code module with the same root name as the .as file. This results in the generation of 3 files with .h, .c and .sql suffixes.
  • Move the .h file into the appropriate inc/ directory.
  • Either add custom code to the end of the .c file, or add a new ...Custom.c file.
  • Edit the .sql file to add the desired INDEXes and (for positional tables) a bin field. (We do not include the bin field in the .as because we do not need it in the C structure -- bin is used only for querying.)

The .as files used to be ignored after running autoSql -- however, we now use the .as files to create the tableDescriptions table in each database which is used by the Table Browser's "describe table schema" page to display descriptions of table fields.


Navigation: back to Implementation_Notes