Bulk Import/Export API

class tgdb.bulkio.TGBulkExport

Represents a single export session with the server.

idColumnName: str

Name of the column to set the ids to in all of the DataFrames exported from the server. Default is ‘id’.

fromColumnName: str

Name of the column to set the from vertex to in all of the DataFrames exported from the server. Only used when exporting edges. Default is ‘from’.

toColumnName: str

Name of the column to set the to vertex to in all of the DataFrames exported from the server. Only used when exporting edges. Default is ‘to’.

abstract exportEntities(handler: Optional[Callable[[tgdb.bulkio.TGBulkExportDescriptor], None]] = None, callPassedHandlerOnAll: bool = False)

Exports all of the entities from the server.

Parameters
  • handler – Handles all of the entities exported. Entities will be exported in batches. The data exported will be set in the data property of the BulkExportDescriptor that is passed to the handler.

  • callPassedHandlerOnAll – If True will call the passed handler on all batches called, regardless of whether that export descriptor already has any handlers. Will call all handlers for that export descriptor regardless of this flag.

class tgdb.bulkio.TGBulkExportDescriptor

Keeps track of various information about all of the entities of a particular type that are exported.

abstract addHandler(handler: Callable[[Any], None])

Add a handler to the list.

Parameters

handler (typing.Callable[[TGBulkImportDescriptor], None]) – Handles entities of this type when they arrive from the server during an export.

abstract clearHandlers()

Removes all handlers for this export of this type.

abstract property data

Gets the data (if any) for this type.

Returns

None if no data exists or a DataFrame that is correctly formatted by the attributes

Return type

pandas.DataFrame

abstract property entitytype

Gets the type of this entity

abstract property hasHandler

Is there more than one handler for this type.

class tgdb.bulkio.TGBulkImport

Represents a single import session with the server.

nodeBatchSize: int

Maximum number of nodes to import in a single request/response with the server.

edgeBatchSize: int

Maximum number of nodes to import in a single in request/response with the server.

idColumnName: str

Name of the column to get the ids from in all of the DataFrames imported to the server. Default is ‘id’.

fromColumnName: str

Name of the column to get the from vertex from in all of the DataFrames imported to the server. Only used when importing edges. Default is ‘from’.

toColumnName: str

Name of the column to get the to vertex from in all of the DataFrames imported to the server. Only used when importing edges. Default is ‘to’.

abstract finish()

Tells the server to clean up the import process.

abstract importEdges(data: Any, edgetype: Union[str, tgdb.model.TGEdgeType] = None, edgedir: tgdb.model.DirectionType = <DirectionType.Directed: 1>)

Imports the edges of the specified type or direction (if no type was specified).

Note: can only import edges of one type one time during an import session. Trying to do more than one will cause an error.

Parameters
  • data (pandas.DataFrame) – The data to send over to the server.

  • defaultType – the name of the type (or the type itself) of the edges imported under this command, or (when None) to use a default edgetype corresponding to the defaultDir. Default is None.

  • defaultDir – the direction for these imported edges. Will be ignored if defaultType is not None. Default is tgdb.DirectionType.Directed

Returns

the bulk import descriptor for the edges imported

Return type

tgdb.admin.TGImportDescriptor

abstract importNodes(data: Any, nodetype: Union[str, tgdb.model.TGNodeType])

Imports the nodes by the specified type.

Note: can only import nodes of one type one time during an import session. Trying to do more than one will cause an error.

Parameters
  • data (pandas.DataFrame) – The data to send over to the server.

  • nodetype – the name of the type (or the type itself) of the nodes imported under this command.

Returns

the bulk import descriptor for the nodes imported

Return type

tgdb.admin.TGImportDescriptor

class tgdb.bulkio.TGDateFormat(value)

An enumeration.

class tgdb.bulkio.TGErrorOptions(value)

An enumeration.

class tgdb.bulkio.TGLoadOptions(value)

An enumeration.