Giter VIP home page Giter VIP logo

mysqlfuse's Introduction

mysqlfuse - Access a MySQL database like a file system

This is an attempt to use FUSE to provide a view of a MySQL database as a filesystem. See the __doc__ string in the mysqlfuse.py file for an explanation.

Currently it MOSTLY works. But not everything really works quite right. This is v.0.00001alpha, mind you.

Concept

The root directory contains subdirs named for each table in the db.

Within each table, we look up the PRIMARY indexes (those have to be unique, right?). Ummm... for the first cut, we'll take them in order given by Sequence (ideally we should be able to take them in all orders, see below). This will be better with an example:

CREATE TABLE `testtab` (
    `key1` varchar(10) default NULL,
    `key2` varchar(7) default NULL,
    `data1` text default NULL,
    `data2` varchar(18) default NULL,
    PRIMARY KEY (`key1`, `key2`)
)

This branch of mysqlfuse is going to have the directories alternating between keyname and keyvalue. This should allow browsing by any ordering of keys.

(N.B. Handling NULL keys and different types of keys (int, varchar) is going to get tricky--actually it hasn't.) The above should lead to this:

.                      testtab
                      /       \
                     /         \
                 key1           key2     (all the key fields)
           _____/ |  \         / |  \
          /       |   \       /  |   \
         foo     ...  bar   baz ...  quux  (all the values for each field)
          |            |     |         |
          |            |     |         |
         key2         key2  key1      key1  (the key fields not above each)
       /  |  \       / | \ / |  \    / |  \
      /   |   \     |  | | | |   |  |  |   \
    baz  ...  quux baz ..  foo..bar foo...  bar  (values for those)
   /   \
 data1  data2  ...

At the bottom level, the filenames are data1 and data2, i.e. all the names of the non-key fields, and each such file contains the value for that field in that row (note that each directory just above the bottom level contains a single row, assuming the keys have to be unique, i.e. primary). Higher-level entries are all directories, not files. They alternate between name-of-a-key-field and values-of-a-key-field. For example, /books/book/My_Friend_Flicka/page/71/pagecontents.

This way, the data can be accessed by any possible permutation of keys, since both /books/book/My_Friend_Flicka/page/71/ and also /books/page/71/book/My_Friend_Flicka/ are there. This gets more fun when there are more elements in the key.

Usage

$ mysqlfuse.py -o host=localhost,user=sqluser,passwd=password,db=databasename <mountpoint>

Debugging information can be found in the DBG file.

Dependencies

On Debian, simply install python-fuse and python-mysql:

$ sudo apt-get install python-fuse python-mysql

mysqlfuse's People

Contributors

clsn avatar cweiske avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.