foliolib.folio.api.ldp.Ldp
- class foliolib.folio.api.ldp.Ldp(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiLibrary Data Platform API
API calls to obtain information generated by the LDP
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
get_columns(**kwargs)Return a list of all columns in a table.
get_config(key)Retrieve a single configuration by key
Return a list of configuration items
Return a list of all tables in all schemas
modify_config(key, config)Modify or add a configuration by key
set_query(query)Send a query to the LDP server and obtain results
- get_columns(**kwargs)
Return a list of all columns in a table. Example: /ldp/db/columns?schema=public&table=user_users
GET /ldp/db/columns- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
schema (str) –
The name of the schema containing the specified table
Example
public
table (str) –
The name of the table within the specified schema
Example
user_users
- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A list of columns in an LDP table", "type": "array", "items": { "type": "object", "properties": { "columnName": { "type": "string", "description": "The name of a column within the specified table" }, "data_type": { "type": "string", "description": "The type of the column", "example": "boolean, character varying, timestamp with time zone" }, "ordinalPosition": { "type": "string", "description": "a small integer specifying ordinal position (though encoded as a string)" }, "tableSchema": { "type": "string", "description": "The schema containing the table containing this column" }, "tableName": { "type": "string", "description": "The table, within its schema, containing this column" } }, "additionalProperties": false, "required": [ "tableName", "tableSchema" ] } }
- get_config(key: str)
Retrieve a single configuration by key
GET /ldp/config/{key}- Parameters
key (str) –
- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A configuration entry for mod-ldp", "type": "object", "properties": { "key": { "type": "string", "description": "The key to the configuration value" }, "value": { "type": "string", "description": "The value of the configuration" } }, "additionalProperties": true, "required": [ "key", "value" ] }
- get_configs()
Return a list of configuration items
GET /ldp/config- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A list of configuration records", "type": "array", "items": { "type": "object", "$ref": "configuration.json" } }
- get_tables()
Return a list of all tables in all schemas
GET /ldp/db/tables- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A collection of LDP table-and-schema pairs", "type": "array", "items": { "type": "object", "properties": { "tableName": { "type": "string", "description": "The name of a table within an LDP schema" }, "tableSchema": { "type": "string", "description": "The name of the LDP schema containing the table" } }, "additionalProperties": false, "required": [ "tableName", "tableSchema" ] } }
- modify_config(key: str, config: dict)
Modify or add a configuration by key
PUT /ldp/config/{key}- Parameters
key (str) –
config (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A configuration entry for mod-ldp", "type": "object", "properties": { "key": { "type": "string", "description": "The key to the configuration value" }, "value": { "type": "string", "description": "The value of the configuration" } }, "additionalProperties": true, "required": [ "key", "value" ] }
- set_query(query: dict)
Send a query to the LDP server and obtain results
POST /ldp/db/query- Parameters
query (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A query to send to the LDP", "type": "object", "properties": { "tables": { "type": "array", "description": "A currently redundant wrapper", "items": { "type": "object", "properties": { "schema": { "type": "string", "description": "The LDP schema containing the table to query" }, "tableName": { "type": "string", "description": "The table to query" }, "columnFilters": { "type": "array", "description": "A set of conditions which result rows must satisfy", "items": { "type": "object", "description": "A single condition which result rows must satisfy", "properties": { "key": { "type": "string", "description": "The name of a column within the specified table" }, "value": { "type": "string", "description": "The value that the specified column must match" } }, "additionalProperties": false, "required": [ "key", "value" ] } }, "showColumns": { "type": "array", "description": "An ordered list of column to include in the results", "items": { "type": "string", "description": "The name of a column within the specified table" } }, "orderBy": { "type": "array", "description": "An ordered list of criteria to sort be", "items": { "type": "object", "description": "A single sorting criterion", "properties": { "key": { "type": "string", "description": "The name of a column within the specified table" }, "direction": { "type": "string", "enum": [ "asc", "desc" ], "description": "Indication of which direction to sort this column [default: 'asc']" }, "nulls": { "type": "string", "enum": [ "start", "end" ], "description": "Indication of where null values should sort [default: 'end']" } }, "additionalProperties": false, "required": [ "key" ] } }, "limit": { "type": [ "integer", "string" ], "description": "The maximum number of rows to return" } }, "additionalProperties": false, "required": [ "schema", "tableName" ] } } }, "additionalProperties": false, "required": [ "tables" ] }
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A set of results from an LDP query", "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true } }