Skip to content

Commit

Permalink
Create show-dictionaries.md
Browse files Browse the repository at this point in the history
  • Loading branch information
soyeric128 committed Oct 18, 2024
1 parent 6bd3af8 commit 76320ec
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: SHOW DICTIONARIES
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.646"/>

Lists dictionaries in a specified database, displaying their names, column details, and source information. Please note that this command currently only lists dictionaries that use MySQL as the data source.

## Syntax

```sql
SHOW DICTIONARIES [FROMIN <database_name>] [LIKE '<pattern>'] [WHERE <condition>]
```

## Examples

This example lists all dictionaries in the current database:

```sql
SHOW DICTIONARIES;

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ database │ dictionary │ key_names │ key_types │ attribute_names │ attribute_types │ source │ comment │
├──────────┼────────────┼───────────────┼───────────────┼─────────────────────────────────┼─────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────┤
│ default │ order_dict │ ['order_id'] │ ['INT NULL'] │ ['customer_name','order_total'] │ ['VARCHAR NULL','INT NULL'] │ mysql(db=dict host=mysql password=[hidden] port=3306 table=orders username=root) │ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

This example uses the LIKE clause to filter dictionaries whose names start with 'order':

```sql
SHOW DICTIONARIES LIKE 'order%';

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ database │ dictionary │ key_names │ key_types │ attribute_names │ attribute_types │ source │ comment │
├──────────┼────────────┼───────────────┼───────────────┼─────────────────────────────────┼─────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────┤
│ default │ order_dict │ ['order_id'] │ ['INT NULL'] │ ['customer_name','order_total'] │ ['VARCHAR NULL','INT NULL'] │ mysql(db=dict host=mysql password=[hidden] port=3306 table=orders username=root) │ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

This example uses the WHERE clause to show dictionaries with the exact name 'order_dict':

```sql
SHOW DICTIONARIES WHERE name = 'order_dict';

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ database │ dictionary │ key_names │ key_types │ attribute_names │ attribute_types │ source │ comment │
├──────────┼────────────┼───────────────┼───────────────┼─────────────────────────────────┼─────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────┤
│ default │ order_dict │ ['order_id'] │ ['INT NULL'] │ ['customer_name','order_total'] │ ['VARCHAR NULL','INT NULL'] │ mysql(db=dict host=mysql password=[hidden] port=3306 table=orders username=root) │ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

0 comments on commit 76320ec

Please sign in to comment.