LISTCOSOBJECTS stored procedure

Last updated: Mar 17, 2025
LISTCOSOBJECTS stored procedure in Data Virtualization

Returns a list of objects from a Cloud Object Storage (COS).

Input parameters

URL
The type of this required parameter is VARCHAR(2000). Specifies the URL of the Cloud Object Storage.
OPTIONSCSV
The type of this optional parameter is VARCHAR(32672). Specifies the comma-separated list of strings for extra options including:
  • MAXOBJS=<N>, where <N> is the max number of objects to retrieve from the URL. The default is -1. To get all objects, use -1, or any negative number.
  • LIMLVLS=<true or false>, determines whether to get only one level of children from a directory. The default is false.

Output parameters

DIAGS
The type of this parameter is VARCHAR(32672). Represents diagnostic output if a failure occurs.

Syntax

Use the following syntax and replace the parameters for this stored procedure:
CALL DVSYS.LISTCOSOBJECTS('<URL>', '<OPTIONSCSV>', ?)

Example

call DVSYS.LISTCOSOBJECTS('s3a://bigsql-local/', 'MAXOBJS=10,LIMLVLS=true', ?)
The output might look like the following text:

+-------------------------------------------------------------------------+-----------+--------+-------------------------+---------+
| URL                                                                     | TYPE      | LENGTH | MODIFIED                | DETAILS |
+-------------------------------------------------------------------------+-----------+--------+-------------------------+---------+
| s3a://bigsql-local/test.csv                                             | text/csv  |      6 | 2021-05-27 10:52:43.223 |         |
| s3a://bigsql-local/i_1622137540270_2041104231_20210527104639828_1.0.csv | text/csv  |      6 | 2021-05-27 10:51:03.506 |         |
| s3a://bigsql-local/files_1000000                                        | directory |      0 | 2021-06-04 12:34:53.915 |         |
| s3a://bigsql-local/files_100000                                         | directory |      0 | 2021-06-04 12:34:53.915 |         |
| s3a://bigsql-local/files_10000                                          | directory |      0 | 2021-06-04 12:34:53.914 |         |
| s3a://bigsql-local/files_1000                                           | directory |      0 | 2021-06-04 12:34:53.914 |         |
| s3a://bigsql-local/Table7                                               | directory |      0 | 2021-06-04 12:34:53.913 |         |
| s3a://bigsql-local/Table3                                               | directory |      0 | 2021-06-04 12:34:53.913 |         |
| s3a://bigsql-local/Table27                                              | directory |      0 | 2021-06-04 12:34:53.913 |         |
| s3a://bigsql-local/Table1                                               | directory |      0 | 2021-06-04 12:34:53.912 |         |
+-------------------------------------------------------------------------+-----------+--------+-------------------------+---------+

10 rows in results(first row: 0.052s; total: 0.066s)

+-------------+----------+
| Return Code | Param #2 |
+-------------+----------+
| -1992425446 | [NULL]   |
+-------------+----------+