Create Property
-
Properties can be created for each node schema and edge schema. Data types supported include int32, int64, uint32, uint64, float, double, string, datetime, timestamp. Properties created are stored in the disk.
-
Create properties for node schema 'test' in current graphset
from ultipa import Connection,ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.createProperty(ULTIPA_REQUEST.CreateProperty(type=ULTIPA.DBType.DBNODE, commonSchema=ULTIPA_REQUEST.CommonSchema(schema='test', property='prop1'), description='desc1', propertyType=ULTIPA.CreatePropertyType.PROPERTY_STRING)) print(ret.toJSON())
-
Create properties for edge schema 'test' in current graphset
from ultipa import Connection,ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.createProperty(ULTIPA_REQUEST.CreateProperty(type=ULTIPA.DBType.DBEDGE, commonSchema=ULTIPA_REQUEST.CommonSchema(schema='test', property='prop2'), description='desc2', propertyType=ULTIPA.CreatePropertyType.PROPERTY_STRING)) print(ret.toJSON())
-
Create properties by composing uQL
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.uql("create().node_property(@<schema>, '<name>', <type?>, '<desc?>')") ret = conn.uql("create().edge_property(@<schema>, '<name>', <type?>, '<desc?>')") print(ret.toJSON())
Show Property
-
Show all properties of node schema 'test' in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.getProperty(ULTIPA_REQUEST.GetProperty(type=ULTIPA.DBType.DBNODE, schema="test")) print(ret.toJSON())
-
Show all properties of edge schema 'test' in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.getProperty(ULTIPA_REQUEST.GetProperty(type=ULTIPA.DBType.DBEDGE, schema="test")) print(ret.toJSON())
-
Show all properties of all node schemas in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.getProperty(ULTIPA_REQUEST.GetProperty(type=ULTIPA.DBType.DBNODE)) print(ret.toJSON())
-
Show all properties of all edge schemas in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.getProperty(ULTIPA_REQUEST.GetProperty(type=ULTIPA.DBType.DBEDGE)) print(ret.toJSON())
-
Show all properties of all schemas (both node and edge) in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.showProperty() print(ret.toJSON())
-
Show properties by composing uQL
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.uql("show().property()") ret = conn.uql("show().node_property()") ret = conn.uql("show().edge_property()") ret = conn.uql("show().node_property(@<schema>)") ret = conn.uql("show().edge_property(@<schema>)") print(ret.toJSON())
Alter Property
-
Modify a certain property's name of node schema 'test' in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.alterProperty(ULTIPA_REQUEST.AlterProperty(type=ULTIPA.DBType.DBNODE, commonSchema=ULTIPA_REQUEST.CommonSchema(schema="test", property="enterprise"), new_name="company", new_description="desc")) print(ret.toJSON())
-
Modify a certain property's name of edge schema 'test' in current graphset
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.alterProperty(ULTIPA_REQUEST.AlterProperty(type=ULTIPA.DBType.DBEDGE, commonSchema=ULTIPA_REQUEST.CommonSchema(schema="test", property="investing"), new_name="holding", new_description="desc")) print(ret.toJSON())
-
Modify properties by composing uQL
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.uql("alter().node_property(@<schema>.<property>).set({name: '<new_name?>', description: '<new_desc?>'})") ret = conn.uql("alter().edge_property(@<schema>.<property>).set({name: '<new_name?>', description: '<new_desc?>'})") print(ret.toJSON())
Drop Property
-
Delete a certain property of node schema 'test' in current graphset
from ultipa import Connection,ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.dropProperty(ULTIPA_REQUEST.DropProperty(type=ULTIPA.DBType.DBNODE, schemaName=ULTIPA_REQUEST.CommonSchema(schemaName='test', propertyName='prop1'))) print(ret.toJSON())
-
Delete a certain property of edge schema 'test' in current graphset
from ultipa import Connection,ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.dropProperty(ULTIPA_REQUEST.DropProperty(type=ULTIPA.DBType.DBEDGE, schemaName=ULTIPA_REQUEST.CommonSchema(schemaName='test', propertyName='prop2'))) print(ret.toJSON())
-
Delete properties by composing uQL
from ultipa import Connection, ULTIPA_REQUEST, ULTIPA conn = Connection(host='host:port', username="root", password="root") ret = conn.uql("drop().node_property(@<schema>.<property>)") ret = conn.uql("drop().edge_property(@<schema>.<property>)") print(ret.toJSON())