dingodb


Namedingodb JSON
Version 0.0.18 PyPI version JSON
download
home_pagehttps://www.dingodb.com/
Summarydingodb is dingodb sdk
upload_time2024-12-03 10:40:09
maintainerNone
docs_urlNone
authorDingoDB
requires_python>=3.7
licenseProprietary License
keywords dingodb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # python-dingodb
The DingoDB python sdk

First, you have prepared the DingoDB environment, see the docs at https://github.com/dingodb/dingo-deploy.git

For more information about DingoDB, see the docs at https://dingodb.readthedocs.io/en/latest/


## How to Contribute

### 1. Compile

```
pip install -r requirements.txt
git submodule update --init --recursive
```

### 2. Release



## Usage

### Installation

1. Install from pypi

```shell
pip3 install dingodb
```

2. Install from Source

```shell
pip install git+https://github.com/dingodb/pydingo.git
```

### Basic API

#### Creating an index

The following example creates an index without a metadata configuration. 
```python
>>> import dingodb
>>> dingo_client = dingodb.DingoDB("user", "password", ["172.20.3.20:13000"])
>>> dingo_client.create_index("testdingo", 6, index_type="flat")
True
```
dingodb provides flexible indexing parameters.
```python
>>> help(dingo_client.create_index)
create_index(index_name, dimension, index_type='hnsw', metric_type='euclidean', replicas=3, index_config=None, metadata_config=None, partition_rule=None, auto_id=True)
```

#### Get index
The following example returns all indexes in your schema.
```python
>>> dingo_client.get_index()
['testdingo']
```

#### Get index info

The following example returns the info in specified index.
```python
>>> dingo_client.describe_index_info("testdingo")
{'name': 'testdingo', 'version': 0, 'replica': 3, 'autoIncrement': 1, 'indexParameter': {'indexType': 'INDEX_TYPE_VECTOR', 'vectorIndexParameter': {'vectorIndexType': 'VECTOR_INDEX_TYPE_FLAT', 'flatParam': {'dimension': 6, 'metricType': 'METRIC_TYPE_L2'}, 'ivfFlatParam': None, 'ivfPqParam': None, 'hnswParam': None, 'diskAnnParam': None}}}
```

#### Add vector

The following example add vector to database.
```python
>>> dingo_client.vector_add("testdingo", [{"a1":"b1", "aa1":"bb1"}, {"a1": "b1"}],[[0.19151945,0.62210876,0.43772775,0.7853586,0.77997583,0.2725926], [0.27746424078941345,0.801872193813324,0.9581393599510193,0.8759326338768005,0.35781726241111755,0.5009950995445251]])
[{'id': 1, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [0.19151945, 0.62210876, 0.43772775, 0.7853586, 0.77997583, 0.2725926], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}, 'aa1': {'fieldType': 'STRING', 'fields': [{'data': 'bb1'}]}}}, {'id': 2, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [0.27746424, 0.8018722, 0.95813936, 0.87593263, 0.35781726, 0.5009951], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}}]
```

#### Get MAX ID

you can use autoIncrement id, The following example get max id
```python
>>> dingo_client.get_max_index_row("testdingo")
2
```

#### Search Vector

The following example Basic Search without metata.
```python
>>> dingo_client.vector_search("testdingo", [[0.19151945,0.62210876,0.43772775,0.7853586,0.77997583,0.2725926]], 10)
[{'vectorWithDistances': [{'id': 1, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}, 'aa1': {'fieldType': 'STRING', 'fields': [{'data': 'bb1'}]}}, 'distance': 0.0}, {'id': 2, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}, 'distance': 0.5491189}]}]
```

The following example Search with metata.
```python
>>> dingo_client.vector_search("testdingo", [0.19151945,0.62210876,0.43772775,0.7853586,0.77997583,0.2725926],10, {"meta_expr": {"aa1": "bb1"}})
{'vectorWithDistances': [{'id': 1, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [], 'binaryValues': []}, 'scalarData': {'aa1': {'fieldType': 'STRING', 'fields': [{'data': 'bb1'}]}, 'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}, 'distance': 0.0}]}
```

#### Query vector with ids

The following example Query vector with ids.
```python
>>> dingo_client.vector_get("testdingo", [2])
[{'id': 2, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [0.27746424, 0.8018722, 0.95813936, 0.87593263, 0.35781726, 0.5009951], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}}]
```

#### Detele vector with ids

The following example Detele vector with ids.
```python
>>> dingo_client.vector_delete("testdingo", [2])
[True]
```

#### Drop index

The following example Drop one index.
```python
>>> dingo_client.delete_index("testdingo")
True
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.dingodb.com/",
    "name": "dingodb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "dingodb",
    "author": "DingoDB",
    "author_email": "dingodb@zetyun.com",
    "download_url": "https://files.pythonhosted.org/packages/72/ef/026bf788eb95dcb1d560ba42264e52537dbec71ba13c567711f04882d3ae/dingodb-0.0.18.tar.gz",
    "platform": null,
    "description": "# python-dingodb\nThe DingoDB python sdk\n\nFirst, you have prepared the DingoDB environment, see the docs at https://github.com/dingodb/dingo-deploy.git\n\nFor more information about DingoDB, see the docs at https://dingodb.readthedocs.io/en/latest/\n\n\n## How to Contribute\n\n### 1. Compile\n\n```\npip install -r requirements.txt\ngit submodule update --init --recursive\n```\n\n### 2. Release\n\n\n\n## Usage\n\n### Installation\n\n1. Install from pypi\n\n```shell\npip3 install dingodb\n```\n\n2. Install from Source\n\n```shell\npip install git+https://github.com/dingodb/pydingo.git\n```\n\n### Basic API\n\n#### Creating an index\n\nThe following example creates an index without a metadata configuration. \n```python\n>>> import dingodb\n>>> dingo_client = dingodb.DingoDB(\"user\", \"password\", [\"172.20.3.20:13000\"])\n>>> dingo_client.create_index(\"testdingo\", 6, index_type=\"flat\")\nTrue\n```\ndingodb provides flexible indexing parameters.\n```python\n>>> help(dingo_client.create_index)\ncreate_index(index_name, dimension, index_type='hnsw', metric_type='euclidean', replicas=3, index_config=None, metadata_config=None, partition_rule=None, auto_id=True)\n```\n\n#### Get index\nThe following example returns all indexes in your schema.\n```python\n>>> dingo_client.get_index()\n['testdingo']\n```\n\n#### Get index info\n\nThe following example returns the info in specified index.\n```python\n>>> dingo_client.describe_index_info(\"testdingo\")\n{'name': 'testdingo', 'version': 0, 'replica': 3, 'autoIncrement': 1, 'indexParameter': {'indexType': 'INDEX_TYPE_VECTOR', 'vectorIndexParameter': {'vectorIndexType': 'VECTOR_INDEX_TYPE_FLAT', 'flatParam': {'dimension': 6, 'metricType': 'METRIC_TYPE_L2'}, 'ivfFlatParam': None, 'ivfPqParam': None, 'hnswParam': None, 'diskAnnParam': None}}}\n```\n\n#### Add vector\n\nThe following example add vector to database.\n```python\n>>> dingo_client.vector_add(\"testdingo\", [{\"a1\":\"b1\", \"aa1\":\"bb1\"}, {\"a1\": \"b1\"}],[[0.19151945,0.62210876,0.43772775,0.7853586,0.77997583,0.2725926], [0.27746424078941345,0.801872193813324,0.9581393599510193,0.8759326338768005,0.35781726241111755,0.5009950995445251]])\n[{'id': 1, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [0.19151945, 0.62210876, 0.43772775, 0.7853586, 0.77997583, 0.2725926], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}, 'aa1': {'fieldType': 'STRING', 'fields': [{'data': 'bb1'}]}}}, {'id': 2, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [0.27746424, 0.8018722, 0.95813936, 0.87593263, 0.35781726, 0.5009951], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}}]\n```\n\n#### Get MAX ID\n\nyou can use autoIncrement id, The following example get max id\n```python\n>>> dingo_client.get_max_index_row(\"testdingo\")\n2\n```\n\n#### Search Vector\n\nThe following example Basic Search without metata.\n```python\n>>> dingo_client.vector_search(\"testdingo\", [[0.19151945,0.62210876,0.43772775,0.7853586,0.77997583,0.2725926]], 10)\n[{'vectorWithDistances': [{'id': 1, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}, 'aa1': {'fieldType': 'STRING', 'fields': [{'data': 'bb1'}]}}, 'distance': 0.0}, {'id': 2, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}, 'distance': 0.5491189}]}]\n```\n\nThe following example Search with metata.\n```python\n>>> dingo_client.vector_search(\"testdingo\", [0.19151945,0.62210876,0.43772775,0.7853586,0.77997583,0.2725926],10, {\"meta_expr\": {\"aa1\": \"bb1\"}})\n{'vectorWithDistances': [{'id': 1, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [], 'binaryValues': []}, 'scalarData': {'aa1': {'fieldType': 'STRING', 'fields': [{'data': 'bb1'}]}, 'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}, 'distance': 0.0}]}\n```\n\n#### Query vector with ids\n\nThe following example Query vector with ids.\n```python\n>>> dingo_client.vector_get(\"testdingo\", [2])\n[{'id': 2, 'vector': {'dimension': 6, 'valueType': 'FLOAT', 'floatValues': [0.27746424, 0.8018722, 0.95813936, 0.87593263, 0.35781726, 0.5009951], 'binaryValues': []}, 'scalarData': {'a1': {'fieldType': 'STRING', 'fields': [{'data': 'b1'}]}}}]\n```\n\n#### Detele vector with ids\n\nThe following example Detele vector with ids.\n```python\n>>> dingo_client.vector_delete(\"testdingo\", [2])\n[True]\n```\n\n#### Drop index\n\nThe following example Drop one index.\n```python\n>>> dingo_client.delete_index(\"testdingo\")\nTrue\n```\n",
    "bugtrack_url": null,
    "license": "Proprietary License",
    "summary": "dingodb is dingodb sdk",
    "version": "0.0.18",
    "project_urls": {
        "Documentation": "https://dingodb.readthedocs.io/en/latest/",
        "Homepage": "https://www.dingodb.com/"
    },
    "split_keywords": [
        "dingodb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc1c35d725ce489248982dd0377e2065de13e9c68479d22d34d8e95be46f9e8d",
                "md5": "cd8207f072a40490ffb6b424df2f5df0",
                "sha256": "a752792c7bb4dd793ef3d1ba19f47b1838de52b47ecebcb4c9123c904d034306"
            },
            "downloads": -1,
            "filename": "dingodb-0.0.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd8207f072a40490ffb6b424df2f5df0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 75816,
            "upload_time": "2024-12-03T10:40:06",
            "upload_time_iso_8601": "2024-12-03T10:40:06.642658Z",
            "url": "https://files.pythonhosted.org/packages/bc/1c/35d725ce489248982dd0377e2065de13e9c68479d22d34d8e95be46f9e8d/dingodb-0.0.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72ef026bf788eb95dcb1d560ba42264e52537dbec71ba13c567711f04882d3ae",
                "md5": "94ae043dd81c3cd6903c549db905402b",
                "sha256": "f3eb979e2769d0d747c5730178086b15b3b2baba59337efd1b8b656f82169a7a"
            },
            "downloads": -1,
            "filename": "dingodb-0.0.18.tar.gz",
            "has_sig": false,
            "md5_digest": "94ae043dd81c3cd6903c549db905402b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 64107,
            "upload_time": "2024-12-03T10:40:09",
            "upload_time_iso_8601": "2024-12-03T10:40:09.958689Z",
            "url": "https://files.pythonhosted.org/packages/72/ef/026bf788eb95dcb1d560ba42264e52537dbec71ba13c567711f04882d3ae/dingodb-0.0.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-03 10:40:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dingodb"
}
        
Elapsed time: 0.88731s