[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-recutils] join basics. Want to extract records, driven from a l

From: recutils
Subject: Re: [bug-recutils] join basics. Want to extract records, driven from a list of "last names".
Date: Tue, 13 Mar 2018 13:01:01 -0500

On Mon 3/12/18 19:38 -0500 address@hidden wrote:
> Have a list of 30 'last_name' values in a file
> foo.rec;
> and a 16000 record list of people in people.rec, which also has 'last_name' 
> values
> and many other fields.
> Want to extract (recsel?) just those people.rec records
> w/the 30 last names in foo.rec.  
> How do I do this?

Answering myself: Based on:

    $ info recutils -n 'Other Field Types'

    Prev: Date and Time Types,  Up: Field Types

    6.7 Other Field Types

    There is one other possible field type, viz: a foreign key.  The
    following example defines the type `Maintainer_t' to be of type "record
    `Hacker'"; in other words, a foreign key referring to a record in the
    `Hacker' record set.
         %typedef: Maintainer_t rec Hacker
       This essentially means that the values to be stored in fields of
    type `Maintainer_t' are of whatever type is defined for the primary key
    of the `Hacker' record set.  Why this is useful is discussed later.
    *Note Queries which Join Records::.

(foo and bar naming does not match my problem statement) I did:

    $ recsel -t bar  -j last_name  bar.rec
    first_name: sam
    last_name_Id: Walters
    last_name_zam: t
    $ cat bar.rec
    %rec: foo
    %key: Id

    Id: Hardy
    zam: t

    Id: Walters
    zam: t

    %rec: bar
    %type: last_name rec foo

    last_name: hakjah
    first_name: ZZZ

    last_name: jhskjsh
    first_name:  hsksj

    last_name: jshkjsh
    first_name:  lsjskj

    last_name: Walters
    first_name: sam

    last_name: jhajh
    first_name:  klsjlk

    last_name: sjhksjh
    first_name:  LKJLKJLK

These lines from above
    %type: last_name rec foo
    last_name_zam: t
are interesting. I know it works, I do not entirely understand the design --
I have only basic SQL exposure, so keep that in mind.  Any 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]