The SAP HANA Document Store (DocStore) is used to store collections which contain one or more JSON artifacts (documents).
You can use standard SQL commands to maintain the document collections in the SAP HANA DocStore and, in addition, the JSON documents that make up the collection, and any values defined in the individual JSON documents.
Note: All these functions do only supported HANA Cloud instances > SP05. Also the document store service needs to be enabled.
The following classes and functions are available:
- hana_ml.docstore.create_collection_from_elements(connection_context: hana_ml.dataframe.ConnectionContext, collection_name: str, elements: list, drop_exist_coll: bool = True, schema: Optional[str] = None)¶
Create a collection of JSON documents and insert JSON-formatted information into the collection
connection_context -- The connection to the SAP HANA system.
collection_name -- Name of the collection, that should be created or to which the records are appended
elements -- JSON List of elements that should be added to the collection
drop_exist_coll -- Drop the existing table when drop_exist_coll is True and appends to the existing collection when it is False. Default is True
schema -- The schema name. If this value is not provided or set to None, then the value defaults to the connection_context's current schema
>>> with open("./path/to/document.json") as json_file: >>> data = json.load(json_file) >>> create_collection_from_elements( >>> connection_context, "test_collection", data, drop_exist_coll=True >>> )