# SearchDB #
*A SQLite powered dictionary*
**Features**
* **Indexed keys and values**
* Can store dicts, lists, tuples as values (they are not indexed in that case)
* **Multi column indexes**
* Use SearchDB as a regular database, store several columns instead of just key-value
* If column is called "JSON" then datatypes can get stored there (they get converted to JSON)
* **Fast Text Search**
* Use Search functions to query large amounts of text.
* Uses FastTextSearch5 functions in SQLite
* **Persists to file**
* Makes sharing dicts easy
* .merge function merges two different databases with the same structure.
## Usage ##
### Basic usage ###
```
In [1]: import SearchDb
In [2]: db = SearchDb.SearchDb(":memory:") # Create an in memory database
In [3]: db["a"] = "alfa"
In [4]: db["a"]
Out[4]: 'alfa'
In [5]: del(db["a"])
In [6]: db["b"] = "beta"
In [7]: db.delete("b")
```
### Store and search text data ###
* Use search_add("unindexed_key", "lots of text") to add large datasets
* Examples:
* Index a book, page is key, value is all text in page
### Use custom indexes ###
To set a custom name for your regular key,value index use:
``.table_in_use("newname")``
To set a custom name for your text search index (one per book for example) use:
``.search_table_in_use("python_for_noobs")``
### Create new table ###
To create a new table (database) use the .create_tables() function.
First set the name of the new table or tables you wish to create, for instance:
```
.table_in_use = "new_key_value"
.multi_table_in_use = "new_multi_column"
.create_tables() # Will now create all the new tables
.search_table_in_use = "new_indexed_texts"
.sdb.create_search_index()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/cpuboi/SearchDb",
"name": "SearchDb",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "SQLite,dictionary,text search",
"author": "cpuboi",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/ae/0e/aefc7b7e4be35ad20ccfb7593eeea79613a6b4d515ab12149f2986396c46/SearchDb-1.0.1.tar.gz",
"platform": null,
"description": "# SearchDB #\n\n*A SQLite powered dictionary*\n\n**Features**\n* **Indexed keys and values**\n * Can store dicts, lists, tuples as values (they are not indexed in that case)\n* **Multi column indexes** \n * Use SearchDB as a regular database, store several columns instead of just key-value\n * If column is called \"JSON\" then datatypes can get stored there (they get converted to JSON)\n* **Fast Text Search**\n * Use Search functions to query large amounts of text.\n * Uses FastTextSearch5 functions in SQLite\n* **Persists to file**\n * Makes sharing dicts easy\n * .merge function merges two different databases with the same structure.\n\n\n## Usage ##\n### Basic usage ###\n```\nIn [1]: import SearchDb\nIn [2]: db = SearchDb.SearchDb(\":memory:\") # Create an in memory database\nIn [3]: db[\"a\"] = \"alfa\"\nIn [4]: db[\"a\"]\nOut[4]: 'alfa'\nIn [5]: del(db[\"a\"])\nIn [6]: db[\"b\"] = \"beta\"\nIn [7]: db.delete(\"b\")\n```\n\n\n### Store and search text data ###\n* Use search_add(\"unindexed_key\", \"lots of text\") to add large datasets\n* Examples:\n * Index a book, page is key, value is all text in page\n\n### Use custom indexes ###\nTo set a custom name for your regular key,value index use: \n``.table_in_use(\"newname\")`` \nTo set a custom name for your text search index (one per book for example) use: \n``.search_table_in_use(\"python_for_noobs\")`` \n\n### Create new table ###\nTo create a new table (database) use the .create_tables() function. \nFirst set the name of the new table or tables you wish to create, for instance:\n```\n.table_in_use = \"new_key_value\" \n.multi_table_in_use = \"new_multi_column\"\n\n.create_tables() # Will now create all the new tables \n\n\n.search_table_in_use = \"new_indexed_texts\" \n.sdb.create_search_index()\n```\n",
"bugtrack_url": null,
"license": "GPLv2",
"summary": "Python dictionary backed by SQLite, includes fast text search and more advanced data structures",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/cpuboi/SearchDb"
},
"split_keywords": [
"sqlite",
"dictionary",
"text search"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ae0eaefc7b7e4be35ad20ccfb7593eeea79613a6b4d515ab12149f2986396c46",
"md5": "212a9f3378643b46bf471684472ec0ec",
"sha256": "4ccf894a5dba30a4c0996a72fed0c6fd678193a92a6906b701296160c718edb8"
},
"downloads": -1,
"filename": "SearchDb-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "212a9f3378643b46bf471684472ec0ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 19299,
"upload_time": "2023-10-29T08:23:03",
"upload_time_iso_8601": "2023-10-29T08:23:03.523653Z",
"url": "https://files.pythonhosted.org/packages/ae/0e/aefc7b7e4be35ad20ccfb7593eeea79613a6b4d515ab12149f2986396c46/SearchDb-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-29 08:23:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cpuboi",
"github_project": "SearchDb",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "searchdb"
}