Skip to content

Commit c3bb69f

Browse files
committed
Updating README.rst ...
1 parent 7c2cb51 commit c3bb69f

File tree

1 file changed

+74
-2
lines changed

1 file changed

+74
-2
lines changed

README.rst

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,79 @@ Sample User Apps/Modules/Scripts
243243
pass_result_to_url:str=None, more_args:dict=None,
244244
notify_url:str=None, notify_args:dict=None):
245245
246-
..
246+
- - Arguments:
247247

248-
| The signature of the entry function determines the JSON structure of the request body payload:
248+
The signature of the entry function determines the JSON structure of the request body payload.
249+
The first two arguments (``connection_string`` and ``command_text``) are required. For example,
249250

251+
.. code-block:: JSON
252+
253+
{
254+
"connection_string": "Provider=MSOLAP;Data Source=The_OLAP;Initial Catalog=The_Cube;Integrated Security=SSPI;Format=Tabular;Connect Timeout=3600",
255+
"command_text": "WITH ... SELECT ... ON COLUMNS, ... ON ROWS FROM ... WHERE ..."
256+
}
257+
258+
``result_model``
259+
260+
- As the default value of the ``result_model`` argument suggests ('**DictOfList**'), the result structural model received by the client will be a dictionary of array, like:
261+
262+
.. code-block:: JSON
263+
264+
{
265+
"Column_A": [value_a1, value_a2, value_a3, ...],
266+
"Column_B": [value_b1, value_b2, value_b3, ...],
267+
"Column_C": [value_c1, value_c2, value_c3, ...],
268+
...
269+
}
270+
271+
This model can be directly passed to Oracle (`PL/SQL Associative Array Parameters <https://github.com/DataBooster/DbWebApi#associative-array-parameters>`__) for storage or further processing.
272+
Please see `PL/SQL Associative Array Parameters <https://github.com/DataBooster/DbWebApi#associative-array-parameters>`__ for more details;
273+
274+
.
275+
276+
- If you want to pass the whole result directly to a `Table-Valued Parameter <https://github.com/DataBooster/DbWebApi#table-valued-parameters>`__ of a SQL Server stored procedure,
277+
it is suitable to set the ``result_model`` parameter to '**SqlTvp**', and the result structure looks like:
278+
279+
.. code-block:: JSON
280+
281+
{
282+
"TableValuedParam":
283+
[
284+
{"Column_A": value_a1, "Column_B": value_b1, "Column_C": value_c1, ... },
285+
{"Column_A": value_a2, "Column_B": value_b2, "Column_C": value_c2, ... },
286+
{"Column_A": value_a3, "Column_B": value_b3, "Column_C": value_c3, ... },
287+
...
288+
]
289+
}
290+
291+
- '**ListOfDict**' is also a commonly used ``result_model``, it looks like:
292+
293+
.. code-block:: python
294+
295+
[
296+
{"Column_A": value_a1, "Column_B": value_b1, "Column_C": value_c1, ... },
297+
{"Column_A": value_a2, "Column_B": value_b2, "Column_C": value_c2, ... },
298+
{"Column_A": value_a3, "Column_B": value_b3, "Column_C": value_c3, ... }
299+
...
300+
]
301+
302+
- There is another built-in ``result_model``: '**ListOfList**', which separates the column header from the value matrix, it looks like:
303+
304+
.. code-block:: python
305+
306+
{
307+
"column_names": ["Column_A", "Column_B", "Column_C", ...],
308+
"value_matrix": [
309+
[value_a1, value_b1, value_c1, ...],
310+
[value_a2, value_b2, value_c2, ...],
311+
[value_a3, value_b3, value_c3, ...],
312+
...
313+
]
314+
}
315+
316+
``column_mapping``
317+
318+
MDX result column headers are often not valid identifiers for most languages. The ``column_mapping`` argument is used to specify the name mapping for certain columns
319+
(other columns not specified in the mapping dictionary will be returned as is. If a column header is mapped to an empty name, the corresponding column will be filtered out from the return).
320+
This is especially useful when passing the entire result of MDX directly to a stored procedure in a database.
321+
It allows you to map MDX column names to input parameter names of the stored procedure.

0 commit comments

Comments
 (0)