> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> O mecanismo `Dictionary` exibe os dados do dicionário como uma tabela do ClickHouse.

# Motor de tabela Dicionário

O mecanismo `Dictionary` exibe os dados do [dicionário](/pt-BR/reference/statements/create/dictionary) como uma tabela do ClickHouse.

<div id="example">
  ## Exemplo
</div>

Como exemplo, considere um Dicionário de `products` com a seguinte configuração:

```xml theme={null}
<dictionaries>
    <dictionary>
        <name>products</name>
        <source>
            <odbc>
                <table>products</table>
                <connection_string>DSN=some-db-server</connection_string>
            </odbc>
        </source>
        <lifetime>
            <min>300</min>
            <max>360</max>
        </lifetime>
        <layout>
            <flat/>
        </layout>
        <structure>
            <id>
                <name>product_id</name>
            </id>
            <attribute>
                <name>title</name>
                <type>String</type>
                <null_value></null_value>
            </attribute>
        </structure>
    </dictionary>
</dictionaries>
```

Consulte os dados do dicionário:

```sql theme={null}
SELECT
    name,
    type,
    key,
    attribute.names,
    attribute.types,
    bytes_allocated,
    element_count,
    source
FROM system.dictionaries
WHERE name = 'products'
```

```text theme={null}
┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐
│ products │ Flat │ UInt64 │ ['title']       │ ['String']      │        23065376 │        175032 │ ODBC: .products │
└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘
```

Você pode usar as funções [dictGet\*](/pt-BR/reference/functions/regular-functions/ext-dict-functions) para obter os dados do dicionário nesse formato.

Essa visualização não é útil quando você precisa acessar dados brutos ou ao realizar uma operação `JOIN`. Nesses casos, você pode usar o mecanismo `Dictionary`, que exibe os dados do dicionário em uma tabela.

Sintaxe:

```sql theme={null}
CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)`
```

Exemplo de uso:

```sql theme={null}
CREATE TABLE products (product_id UInt64, title String) ENGINE = Dictionary(products);
```

Ok

Veja o que há na tabela.

```sql theme={null}
SELECT * FROM products LIMIT 1;
```

```text theme={null}
┌────product_id─┬─title───────────┐
│        152689 │ Some item       │
└───────────────┴─────────────────┘
```

**Veja também**

* [função Dicionário](/pt-BR/reference/functions/table-functions/dictionary)
