ClickHouse/docs/fa/engines/table_engines/special/dictionary.md

98 lines
3.3 KiB
Markdown
Raw Normal View History

2020-03-30 08:25:29 +00:00
---
machine_translated: true
2020-04-04 09:15:31 +00:00
machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626
toc_priority: 35
toc_title: "\u0648\u0627\u0698\u0647\u0646\u0627\u0645\u0647"
2020-03-30 08:25:29 +00:00
---
2020-04-04 09:15:31 +00:00
# واژهنامه {#dictionary}
2020-04-04 09:15:31 +00:00
این `Dictionary` موتور نمایش [واژهنامه](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) داده ها به عنوان یک جدول کلیک.
2020-04-04 09:15:31 +00:00
به عنوان مثال, در نظر گرفتن یک فرهنگ لغت از `products` با پیکربندی زیر:
``` xml
<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>
```
2020-04-04 09:15:31 +00:00
پرس و جو داده فرهنگ لغت:
``` sql
SELECT
name,
type,
key,
attribute.names,
attribute.types,
bytes_allocated,
element_count,
source
FROM system.dictionaries
WHERE name = 'products'
```
``` text
┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐
│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │
└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘
```
2020-04-04 09:15:31 +00:00
شما می توانید از [دیکته کردن\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) تابع برای دریافت داده های فرهنگ لغت در این فرمت.
2020-04-04 09:15:31 +00:00
این دیدگاه مفید نیست که شما نیاز به دریافت داده های خام, و یا در هنگام انجام یک `JOIN` عمل برای این موارد می توانید از `Dictionary` موتور, که نمایش داده فرهنگ لغت در یک جدول.
2020-04-04 09:15:31 +00:00
نحو:
``` sql
CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)`
```
2020-04-04 09:15:31 +00:00
به عنوان مثال استفاده:
``` sql
create table products (product_id UInt64, title String) Engine = Dictionary(products);
```
Ok
2020-04-04 09:15:31 +00:00
نگاهی به در چه چیزی در جدول.
``` sql
select * from products limit 1;
```
``` text
┌────product_id─┬─title───────────┐
│ 152689 │ Some item │
└───────────────┴─────────────────┘
```
2020-04-04 09:15:31 +00:00
[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) <!--hide-->