unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: Romel Sandoval <romel@lavabit.com>
Cc: guile-user@gnu.org
Subject: Re: Data Dictionary and Configuration Files with Guile Scheme
Date: Wed, 18 Aug 2010 20:20:40 +0200	[thread overview]
Message-ID: <87zkwj9407.fsf@ambire.localdomain> (raw)
In-Reply-To: <1281028544.2624.38.camel@romel-compaq> (Romel Sandoval's message of "Thu, 05 Aug 2010 12:15:44 -0500")

() Romel Sandoval <romel@lavabit.com>
() Thu, 05 Aug 2010 12:15:44 -0500

   What do you think?

I use Guile-PG (several modules) and a homegrown metainfo table
accessible via ‘(ttn-do zzz various-db) personal-pgtable-defs’ et al:
http://www.gnuvola.org/software/ttn-do/ttn-do.html.gz#zzz-various_002ddb

Here is ~/.pgtable-defs, omitting some parts:

  ;;; ~/.pgtable-defs --- database descriptions -*- scheme -*-
  
  ;; Keyword Expansions
  ;; ------------------
  
  ((#:pk "PRIMARY KEY")
   (#:u  "UNIQUE")
   (#:nn "NOT NULL")
   (#:mf "MATCH FULL")
   (#:dc "ON DELETE CASCADE")
   (#:uc "ON UPDATE CASCADE")
   (#:r  "REFERENCES")
   (#:tz "WITH TIME ZONE"))
  
  ;; Database Table Definitions
  ;; --------------------------
  ;;
  ;; ((DB-1 (TABLE DEF ...) (TABLE DEF ...) ...)
  ;;  (DB-2 (TABLE DEF ...) (TABLE DEF ...) ...) ...)
  ;;
  ;; Some day `infer-defs' will be able to round-trip these...
  
  (("ttn"
  
    ("sw_maint"
     (v    bool #:nn)
     (url  text #:nn)
     (mon  text #:nn)
     (name text #:pk)
     (orig text)
     (mtim timestamp[])))                 ; 0: mon
  
   ("gnuvola"
  
    ("updbad"
     (time     timestamp #:pk)
     (cause    text)
     (errmsg   text))
  
    ("updok"
     (time     timestamp #:pk)
     (wrote    int4)
     (read     int4)
     (rate     float4)
     (total    int4)
     (speedup  float4))
  
    ("updfiles"
     (file     text)
     (move     char)
     (time     timestamp #:r "updok" #:dc #:uc))))
  
  ;;; ~/.pgtable-defs ends here

This file consists of two forms.  The first is (hopefully)
self-explanatory.  The second describes two databases:

  db       tables
  -------  -----------------------
  ttn      sw_maint
  gnuvola  updbad, updok, updfiles

Each table's columns are further described in a way that really ought to
be queryable from the backend, so that is a Code Enhancement Opportunity
for the Guile-PG reflection module alluded to by the "Some day" comment.

Although i think SQL is ugly (and thus concur in jest, i believe,
with Andy Wingo's admonition :-), Guile-PG makes it livable.  E.g.:
http://www.gnuvola.org/software/guile-pg/qcons-notes.txt

So, to answer your question: yes, sexps work fine as a Data Dictionary.



  parent reply	other threads:[~2010-08-18 18:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 17:15 Data Dictionary and Configuration Files with Guile Scheme Romel Sandoval
2010-08-05 21:04 ` No Itisnt
2010-08-18 16:05 ` Andy Wingo
2010-08-18 17:38   ` Romel Sandoval
2010-08-18 18:20 ` Thien-Thi Nguyen [this message]
2010-08-20 14:10   ` Romel Sandoval
2010-08-20 14:39     ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zkwj9407.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=guile-user@gnu.org \
    --cc=romel@lavabit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).