项目作者: kunesj

项目描述 :
Filesystem Database
高级语言: Python
项目地址: git://github.com/kunesj/fsdb.git
创建时间: 2019-04-27T18:42:44Z
项目社区:https://github.com/kunesj/fsdb

开源协议:GNU Lesser General Public License v3.0

下载


FSDB (Filesystem Database)

Extremely dumb and minimalistic database.

  • Saves tables and records in folder tree on disk
  • Aims to use least processing power when idle
  • All database files are human readable
  • low CPU, low RAM, higher DB disk size, low speed

TODO

  • implement required fields (attribute already implemented)
  • implement unique fields (attribute already implemented)
  • transactions and/or multi-threaded access (maybe quick dirty fix that makes new connections wait until is free???)
  • run as db server -> connections, open/close database, …

Example

Database configuration given to Manager.init_from_config(config)

  1. [
  2. {
  3. "name": "website_db",
  4. "tables": [
  5. {
  6. "name": "users",
  7. "fields": [
  8. {"name": "id", "type": "int"},
  9. {"name": "login", "type": "str", "required": true, "unique": true},
  10. {"name": "password", "type": "str", "required": true}
  11. ],
  12. "records": [
  13. {
  14. "id": 1,
  15. "login": "USER_NAME",
  16. "password": "DEFAULT_PASSWORD"
  17. }
  18. ]
  19. },
  20. {
  21. "name": "blog_posts",
  22. "fields": [
  23. {"name": "id", "type": "datetime"},
  24. {"name": "name", "type": "str", "required": true, "default": "Title"},
  25. {"name": "text_md", "type": "file"},
  26. {"name": "text_html", "type": "file"},
  27. {"name": "files", "type": "file_list"},
  28. {"name": "author", "type": "str"},
  29. {"name": "public", "type": "bool", "default": false}
  30. ]
  31. },
  32. {
  33. "name": "pages",
  34. "fields": [
  35. {"name": "id", "type": "int"},
  36. {"name": "name", "type": "str", "required": true, "default": "Title"},
  37. {"name": "text_md", "type": "file"},
  38. {"name": "text_html", "type": "file"},
  39. {"name": "files", "type": "file_list"},
  40. {"name": "author", "type": "str"},
  41. {"name": "public", "type": "bool", "default": false}
  42. ]
  43. }
  44. ]
  45. }
  46. ]

Result (after a bit of use)

  1. WEBSERVER
  2. └── website_db
  3. ├── blog_posts
  4. ├── 2015-04-16T13-18-00.000000
  5. ├── data.json
  6. ├── text.html
  7. └── text.md
  8. ├── 2015-04-16T16-25-00.000000
  9. ├── data.json
  10. ├── text.html
  11. └── text.md
  12. ├── 2015-05-08T21-51-00.000000
  13. ├── data.json
  14. ├── files
  15. ├── ct24_1.png
  16. ├── ct24_2b.png
  17. └── ct24_3.png
  18. ├── text.html
  19. └── text.md
  20. ├── 2015-05-28T03-08-00.000000
  21. ├── data.json
  22. ├── text.html
  23. └── text.md
  24. ├── 2015-06-01T23-58-00.000000
  25. ├── data.json
  26. ├── files
  27. └── pyinstaller_makefile.png
  28. ├── text.html
  29. └── text.md
  30. └── data.json
  31. ├── data.json
  32. ├── pages
  33. ├── 1
  34. ├── data.json
  35. ├── files
  36. └── omad_preview.png
  37. ├── text.html
  38. └── text.md
  39. ├── 2
  40. ├── data.json
  41. ├── text.html
  42. └── text.md
  43. ├── 3
  44. ├── data.json
  45. ├── text.html
  46. └── text.md
  47. ├── 4
  48. ├── data.json
  49. ├── text.html
  50. └── text.md
  51. └── data.json
  52. └── users
  53. ├── 1
  54. └── data.json
  55. └── data.json