Partager via


usql.partitions (U-SQL)

Summary

Contains one row per partition scheme for the partitioned tables in the schemas of the current database context. The partitioned table must contain at least one record.

Column name Data type Description
partition_id_guid Guid Partition identifier
object_id_guid Guid Identifier of the object on which the partition is specified.
index_id int Identifier of the index for which the partition is specified.

Examples

The examples can be executed in Visual Studio with the Azure Data Lake Tools plug-in.

Query the usql.partitions view

USE TestReferenceDB;

OUTPUT usql.partitions
TO "/ReferenceGuide/CatalogViews/partitions.txt"
USING Outputters.Tsv(outputHeader:true);

Query the usql.partitions view with other catalog views

@partitions =
    SELECT o.name AS tableName,
            c.name AS columnName,
            p.*
    FROM usql.partitions AS p
    JOIN usql.objects AS o
    ON p.object_id_guid == o.object_id_guid
    JOIN usql.partition_parameters AS pp
    ON p.object_id_guid == pp.object_id_guid
    JOIN usql.columns AS c
    ON o.object_id_guid == c.object_id_guid
    AND pp.column_id == c.column_id;

OUTPUT @partitions
TO "/ReferenceGuide/CatalogViews/partitions_others.txt"
USING Outputters.Tsv(outputHeader:true);   

See Also