Update: This node seems to have been downvoted quite a few times (it's hard to tell how many) but has no replies. Anyone care to explain to me what is the fundamental flaw in the scheme below? I'm not saying it's the "one true way" to access a database or anything, just that many dbs have a hierarchical structure embedded in them and so being able to access that through a hierarchical interface (a filesystem) makes a lot of sense, to me anyway.

I'd says stick it up there. The more the merrier. I certainly would like to see it even just as an example to base other work on.

Some other comments have pointed out that tables do not map to a filesystem but I don't agree. A table maps perfectly to a directory full of subdirectories (one for each row in the table). Each name of each subdirectory should correspond to the primary key for that row. Each row's directory would have a file for each field which you can edit directly. Any field that is a foreign key, referencing another table could have 2 entries, one for the actual value and another that is a symlink to the row in the table that is referenced.

For example here's the table definitions.

CREATE TABLE persons (name CHAR(50) PRIMARY KEY, company char(50) refe +rences companies.name); CREATE TABLE companies (name CHAR(50) PRIMARY KEY, business char(50));
now wandering around the filesystem would look like
> cd db > ls persons companies > ls persons Fergal Daly Bill O'Brien > cd "persons/Fergal Daly" > ls name company company:row > cat company Blogtronic > ls -l company:row cmopany:row -> ../../companies/Blogtronic > ls company:row name business > cat company:row/business Maker of electric lawnmowers and dangerous toys
tables map just fine onto a filesystem. You could even get fancy and provide automatic reverse lookups on foreign keys
> cd companies/Blogtronic > ls name business :referers > ls :referers persons > ls referers/persons company > ls referers/persons/company Fergal Daly ... other rows of persons who's company field references Blogtronic's +primary key
This allows very compfortable wandering around the database, editing fields etc. It's not a great interface for queries though. I think this is actually something like reiserfs's goal.

In reply to Re: RFC: Fuse::DBI - mount database as filesystem by fergal
in thread RFC: Fuse::DBI - mount database as filesystem by dpavlin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.