From 0ddd94423fc80422b306f9f9a8f6ca961bbef5c9 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 13 Jan 2015 22:03:59 +0100 Subject: [PATCH] Update README with concept and dependencies --- .gitignore | 2 ++ README | 11 ------- README.rst | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 11 deletions(-) create mode 100644 .gitignore delete mode 100644 README create mode 100644 README.rst diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2614141 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +DBG +README.html diff --git a/README b/README deleted file mode 100644 index 92c81dd..0000000 --- a/README +++ /dev/null @@ -1,11 +0,0 @@ -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. - -Usage: - -mysqlfuse.py -o host=localhost,user=sqluser,passwd=password,db=databasename - diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..cea94b8 --- /dev/null +++ b/README.rst @@ -0,0 +1,89 @@ +****************************************************** +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 + +Debugging information can be found in the ``DBG`` file. + + +Dependencies +============ +* fuse-python__ +* MySQL-Python__ + +__ https://pypi.python.org/pypi/fuse-python +__ http://mysql-python.sourceforge.net/ + +On Debian, simply install ``python-fuse`` and ``python-mysql``:: + + $ sudo apt-get install python-fuse python-mysql