Cmdlets for Databricks

Build 24.0.9060

PrimaryKeyIdentifiers Parameter (Connect-Databricks Cmdlet)

Set this property to define primary keys.

Syntax

Connect-Databricks -PrimaryKeyIdentifiers string

Data Type

cstr

Default Value

""

Remarks

Databricks does not natively support primary keys, but for certain DML operations or database tools you may need to define them. By default this option is disabled so that no tables have primary keys.

Primary keys are defined using a list of rules that match tables and provide a list of key columns. For example, PrimaryKeyIdentifiers="*=my_key;my_table=my_key2,my_key3;my_nokeys_table=;" has three rules separated by semicolons:

  1. The first rule *=my_key means that every table without a more specific rule contains one primary key column called my_key. Tables without a my_key column do not have any primary keys. Multiple keys are supported; set *=my_key,my_key2" to specify them.
  2. The second rule my_table=my_key2,my_key3 means that the my_table table contains the two primary key columns my_key2 and my_key3. If any of those columns are missing from the table they are ignored.
  3. The third rule my_nokeys_table= means that the my_nokeys_table table has no primary keys. The only use that empty key lists have is overriding the default rule. If there is no default rule present, only tables with primary keys are explicitly listed.

Note that the table names can include

  • just the table
  • the table and schema
  • the table, schema, and catalog
You can use SQL quotes to specify column and table names:
/* Rules with just table names use the default connection Catalog and Schema. 
   All these rules refer to the same table with a connection where Catalog=someCatalog;Schema=someSchema */

someTable=a,b,c
someSchema.someTable=a,b,c
someCatalog.someSchema.someTable=a,b,c

/* Any table or column name may be quoted */
`someCatalog`."someSchema".[someTable]=`a`,[b],"c"

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060