实体引用Entity references

在查询中使用 Kusto 架构实体的名称来引用它们。Reference Kusto schema entities in a query by using their names. 有效的实体名称包括数据库、表、列和存储函数 。Valid entity names include databases , tables , columns , and stored functions. 群集不能通过其名称进行引用。Clusters can't be referenced by their names. 如果实体容器在当前上下文中是明确的,请使用实体名称而无需附加限定条件。If the entity's container is unambiguous in the current context, use the entity name without additional qualifications. 例如,当对名为 DB 的数据库运行查询时,可以通过名称 T 引用该数据库中名为 T 的表。For example, when running a query against a database called DB, you may reference a table called T in that database by its name, T.

如果实体容器在上下文中不可用,或者你希望从与上下文中的容器不同的容器中引用实体,请使用实体的限定名称。If the entity's container isn't available from the context, or you want to reference an entity from a container different than the container in context, use the entity's qualified name . 此名称是实体名称与容器名称(可能还有该容器的容器的名称,依此类推)的串联。The name is the concatenation of the entity name to the container's, and potentially its container's, and so on. 通过这种方式,针对数据库 DB 运行的查询可以通过使用 database("DB1").T1 引用同一群集的不同数据库 DB1 中的表 T1In this way, a query running against database DB may refer to a table T1 in a different database DB1 of the same cluster, by using database("DB1").T1. 如果查询要引用另一个群集中的表,可通过使用 cluster("https://C2.kusto.chinacloudapi.cn/").database("DB2").T2 之类的方法来实现此目的。If the query wants to reference a table from another cluster it can do so, for example, by using cluster("https://C2.kusto.chinacloudapi.cn/").database("DB2").T2.

实体引用也可以使用实体友好名称,前提是它在实体容器的上下文中是唯一的。Entity references can also use the entity pretty name, as long as it's unique in the context of the entity's container. 有关详细信息,请参阅实体友好名称For more information, see entity pretty names.

实体名称的通配符匹配Wildcard matching for entity names

在某些上下文中,可以使用通配符 (*) 来匹配全部或部分实体名称。In some contexts, you may use a wildcard (*) to match all or part of an entity name. 例如,以下查询引用当前数据库中的所有表以及数据库 DB 中名称以 T 开头的所有表:For example, the following query references all tables in the current database, and all tables in database DB whose name starts with a T:

union *, database("DB1").T*

备注

通配符匹配不能匹配以美元符号 ($) 开头的实体名称。Wildcard matching can't match entity names that start with a dollar sign ($). 此类名称是系统保留的。Such names are system-reserved.

后续步骤Next steps