Request for table data
- Request to get tables data is carried out using the method getTableDataPredicate(field “method”).
The following are specified as parameters (the “params” field):
entityName
- table nameschemaName
- schema nameaggregate
- block for setting aggregating functionslimit
- sample sizeoffset
- record number from which to start selectionprimaryKey
- field name - primary keycurrentKey
- the current value of the primary key. It can be omitted, but if it is set, the offset ignored and the will be exact page of data will be returned, on which there is a record with the specified valuejoin
- tables that need to be joined to theresults query. For each table it is indicated:schema
- schema nameentity
- table namekey
- field of the main table, by which we connectentityKey
- field of the joined tabletable_alias
is an alias that is assigned to the joined tableparent_table_alias
- alias of the main tablevirtual
- flag if a virtual field attached table
- fields - fields to load. For each field, the following is determined:
table_alias
is the alias of the table that this belongs to fieldsubfields
- fields of the table associated with this field, which should be displayed instead of it (if the field is a foreign key)subfields_table_alias
- the corresponding subfields aliases tablesubfields_navigate_alias
- base table aliassubfields_key
- base table key
- predicate - predicate
operands
- operandslevelup
- used for multilevel conditionsfield
- fieldpath
- ignoredop
- operator (see the values in Filtering by default)value
- the second operandsearch_in_key
- search for data also in the keytable_alias
is the alias of the table in which the field is locatedstrict
- true if the operands are connected by “AND”
[
{
"entityName": "ticket_flights",
"schemaName": "bookings",
"predicate": {
"strict": true,
"operands": [
{
"levelup": false,
"operand": {
"field": "fare_conditions",
"path": [
"fare_conditions"
],
"op": "EQ",
"value": "Economy",
"search_in_key": false,
"table_alias": "t"
}
},
{
"levelup": false,
"operand": {
"field": "amount",
"path": [
"amount"
],
"op": "G",
"value": "25000",
"search_in_key": false,
"table_alias": "t"
}
}
]
},
"aggregate": [
{
"func": "avg",
"field": "amount"
}
],
"limit": "10",
"offset": 20,
"primaryKey": "ticket_no",
"currentKey": "",
"fields": {
"ticket_no": {
"table_alias": "t",
"subfields": null,
"hidden": false
},
"flight_id": {
"table_alias": "t",
"subfields": [
"flight_no",
"airport_code"
],
"subfields_navigate_alias": "t0",
"subfields_table_alias": [
"t0",
"t1"
],
"subfields_key": "flight_id"
},
"fare_conditions": {
"table_alias": "t"
},
"amount": {
"table_alias": "t"
}
},
"join": [
{
"key": "flight_id",
"virtual": false,
"schema": "bookings",
"entity": "flights",
"table_alias": "t0",
"parent_table_alias": "t",
"entityKey": "flight_id"
},
{
"key": "departure_airport",
"virtual": false,
"schema": "bookings",
"entity": "airports_data",
"table_alias": "t1",
"parent_table_alias": "t0",
"entityKey": "airport_code"
}
],
"order": [],
"process": null,
"functions": [],
"format": "array",
"desc": "Loading the table \"Flight segment\ ""
}
]
If the request was successful, the server will send the following data in response:
{
"jsonrpc": "2.0",
"result": {
"data": [
[
"0005433805700",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433763343",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005434171107",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433785282",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433785263",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433763347",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433805688",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005434171043",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433763334",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
],
[
"0005433805706",
"{\"f1\ ":\"PG0356 LED\ ",\"f2\ ":\"9348\ "}",
"Economy",
"62100.00"
]
],
"records": [
{
"count": "161039"
}
],
"offset": 20,
"fields": [
"ticket_no",
"flight_id",
"fare_conditions",
"amount"
],
"sql": "SELECT \"t\ ".\"Ticket_no\ ", (row_to_json (row (COALESCE (t0.\"Flight_no\ ":: text, '') || '' || COALESCE (t1.\"Airport_code\ ":: text, ''), t0.\ "flight_id\":: text)) :: text) collate \ "C\" as \ "flight_id\", \ "t\".\ "fare_conditions\", \ "t\".\ "amount\" FROM \ "bookings\".\ "ticket_flights\" as t left join \ "bookings\".\ "flights\" as \ "t0\" on \ "t\".\ "flight_id\" = \ "t0\".\ "flight_id\" left join \ "bookings\".\ "airports_data\" as \ "t1\" on \ "t0\".\ "departure_airport\" = \ "t1\".\ "airport_code\" where (\ "t\".\ "fare_conditions\" = 'Economy') AND (\ "t\".\ "amount\" > '25000') LIMIT 10 OFFSET 20 ",
"avg (amount)": [
{
"avg": "40528.439073764740"
}
]
},
"error": null,
"usename": "",
"pids": 0
}
error
- error code with the value “null”;jsonrpc
- protocol version with value “2.0”;result
- data returned by the method:data
- directly a list of table records;offset
- offset of records, when requesting lines not from the first line;records
- displays the number of records in the table;sql
- SQL query to the database;
usename
- username if authorization was performed.