AutoSql: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 12: Line 12:


Navigation: back to [[Implementation_Notes]]
Navigation: back to [[Implementation_Notes]]
[[Category:Technical FAQ]]

Revision as of 18:37, 8 May 2006

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