# python-openobserve
A python connector to submit information to OpenObserve (https://github.com/openobserve/openobserve)
The idea is to have a similar python connector to the "Elasticsearch" package, which allows a 1:1 replacement of the "Elasticsearch" package with the "OpenObserve" package.
OpenObserve is way more lightweight than Elasticsearch, and it is open source, like everything should be.
## install
`pip install python-openobserve`
## usage
see [example.ipynb](example.ipynb) for a full example
```python
from python_openobserve.openobserve import OpenObserve
OO = OpenObserve(user = "root@example.com", password = "Complexpass#123")
from datetime import datetime
from random import random
from pprint import pprint
document = {
"@timestamp" : datetime.utcnow(),
"component" : "testagent",
"action" : "buy",
"amount" : random() * 100,
"portfolio" : {
"USD" : random() * 100.0,
"BTC" : 0.1 + random() * 0.1
}
}
pprint(document)
# insert document
OO.index("dd", document)
#search
# example sql parsing helper
sql = 'SELECT * FROM "dd"'
results = OO.search(sql)
print(f"got {len(results)} results")
pprint(results)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/JustinGuese/python-openobserve",
"name": "python-openobserve",
"maintainer": null,
"docs_url": null,
"requires_python": ">3.9",
"maintainer_email": null,
"keywords": "openobserve, elasticsearch, logging, unstructured data",
"author": "Justin Guese",
"author_email": "guese.justin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/36/9e/1805ec21fc09a0634227ba5ed5d591824931cb4e768f0952db128905d8eb/python_openobserve-0.1.4.tar.gz",
"platform": null,
"description": "# python-openobserve\nA python connector to submit information to OpenObserve (https://github.com/openobserve/openobserve)\n\nThe idea is to have a similar python connector to the \"Elasticsearch\" package, which allows a 1:1 replacement of the \"Elasticsearch\" package with the \"OpenObserve\" package.\n\nOpenObserve is way more lightweight than Elasticsearch, and it is open source, like everything should be.\n\n## install\n\n`pip install python-openobserve`\n\n## usage\n\nsee [example.ipynb](example.ipynb) for a full example\n\n```python\nfrom python_openobserve.openobserve import OpenObserve\n\nOO = OpenObserve(user = \"root@example.com\", password = \"Complexpass#123\")\n\nfrom datetime import datetime\nfrom random import random\nfrom pprint import pprint\ndocument = {\n \"@timestamp\" : datetime.utcnow(),\n \"component\" : \"testagent\",\n \"action\" : \"buy\", \n \"amount\" : random() * 100,\n \"portfolio\" : {\n \"USD\" : random() * 100.0,\n \"BTC\" : 0.1 + random() * 0.1\n }\n}\npprint(document)\n\n# insert document\nOO.index(\"dd\", document)\n\n#search\n# example sql parsing helper\nsql = 'SELECT * FROM \"dd\"'\nresults = OO.search(sql)\nprint(f\"got {len(results)} results\")\npprint(results)\n```",
"bugtrack_url": null,
"license": "GNUv3",
"summary": null,
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/JustinGuese/python-openobserve",
"Repository": "https://github.com/JustinGuese/python-openobserve"
},
"split_keywords": [
"openobserve",
" elasticsearch",
" logging",
" unstructured data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "398a226d65211ffb158280dcb3d419a030014e5f15b1eedaf24e8aadb5851e43",
"md5": "97195bae8a55a4544fec1efe704cbb22",
"sha256": "bc78f4ee675318f6ab40f58fbfc10fca14798d19a9aef724cbd00f5aab5ecc18"
},
"downloads": -1,
"filename": "python_openobserve-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "97195bae8a55a4544fec1efe704cbb22",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">3.9",
"size": 15889,
"upload_time": "2025-01-16T15:00:35",
"upload_time_iso_8601": "2025-01-16T15:00:35.111208Z",
"url": "https://files.pythonhosted.org/packages/39/8a/226d65211ffb158280dcb3d419a030014e5f15b1eedaf24e8aadb5851e43/python_openobserve-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "369e1805ec21fc09a0634227ba5ed5d591824931cb4e768f0952db128905d8eb",
"md5": "84be5a853e1e540a7f5892bbfe6d3dd5",
"sha256": "31203a22ef6ac5d74b5ae099dea0a7cfd66a4f062a4e02179e3e47f46b2b5c32"
},
"downloads": -1,
"filename": "python_openobserve-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "84be5a853e1e540a7f5892bbfe6d3dd5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">3.9",
"size": 14712,
"upload_time": "2025-01-16T15:00:37",
"upload_time_iso_8601": "2025-01-16T15:00:37.714218Z",
"url": "https://files.pythonhosted.org/packages/36/9e/1805ec21fc09a0634227ba5ed5d591824931cb4e768f0952db128905d8eb/python_openobserve-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-16 15:00:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JustinGuese",
"github_project": "python-openobserve",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-openobserve"
}