Skip to content

Commit

Permalink
docs: list_stage table function. (#12175)
Browse files Browse the repository at this point in the history
* docs: list_stage table function.

* updates

---------

Co-authored-by: soyeric128 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 24, 2023
1 parent 87f7df3 commit ec26e8d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/doc/14-sql-commands/00-ddl/40-stage/04-ddl-list-stage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ sidebar_label: LIST STAGE FILES

Lists files in a stage.

See also: [LIST_STAGE](../../../15-sql-functions/112-table-functions/list_stage.md)

## Syntax

```sql
Expand Down
52 changes: 52 additions & 0 deletions docs/doc/15-sql-functions/112-table-functions/list_stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: LIST_STAGE
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced: v1.2.32"/>

Lists files in a stage. This allows you to filter files in a stage based on their extensions and obtain comprehensive details about each file. The function is similar to the DDL command [LIST STAGE FILES](../../14-sql-commands/00-ddl/40-stage/04-ddl-list-stage.md), but but provides you the flexibility to retrieve specific file information with the SELECT statement, such as file name, size, MD5 hash, last modified timestamp, and creator, rather than all file information.

## Syntax

```sql
LIST_STAGE(
LOCATION => '{ internalStage | externalStage }'
[ PATTERN => '<regex_pattern>']
)
```

Where:

### internalStage

```sql
internalStage ::= @<internal_stage_name>[/<path>]
```

### externalStage

```sql
externalStage ::= @<external_stage_name>[/<path>]
```

### userStage

```sql
userStage ::= @~[/<path>]
```

## Examples

```sql
SELECT * FROM list_stage(location => '@my_stage/', pattern => '.log');
+----------------+------+------------------------------------+-------------------------------+---------+
| name | size | md5 | last_modified | creator |
+----------------+------+------------------------------------+-------------------------------+---------+
| 2023/meta.log | 475 | "4208ff530b252236e14b3cd797abdfbd" | 2023-04-19 20:23:24.000 +0000 | NULL |
| 2023/query.log | 1348 | "1c6654b207472c277fc8c6207c035e18" | 2023-04-19 20:23:24.000 +0000 | NULL |
+----------------+------+------------------------------------+-------------------------------+---------+

-- Equivalent to the following statement:
LIST @my_stage PATTERN = '.log';
```

1 comment on commit ec26e8d

@vercel
Copy link

@vercel vercel bot commented on ec26e8d Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend-git-main-databend.vercel.app
databend-databend.vercel.app
databend.vercel.app
databend.rs

Please sign in to comment.