简体   繁体   English

将主键和外键添加到 Databricks 上的 SQL 表

[英]Adding Primary and Foreign keys to SQL Table on Databricks

I'm new to Databricks and when I want to alter my SQL tables by adding primary or FK, I get an absurd error that can't seem to debug it.我是 Databricks 的新手,当我想通过添加主要或 FK 来更改我的 SQL 表时,我收到一个似乎无法调试的荒谬错误。

%sql
ALTER TABLE samples_abp215dsdp ADD CONSTRAINT PRIMARY (SampleID);

here is the error message:这是错误消息:

Error in SQL statement: ParseException: 
mismatched input '(' expecting {'CHECK', 'FOREIGN', 'PRIMARY', 'UNIQUE'}(line 1, pos 55)

== SQL ==
ALTER TABLE samples_abp215dsdp ADD CONSTRAINT PRIMARY (SampleID)
------------------------------------------------------^^^

any help will be appreciated.任何帮助将不胜感激。

spark do not have any concept of primary key. spark没有任何主键的概念。 As spark is computation engine not database.由于 spark 是计算引擎而不是数据库。

There are new features coming in 2022 . 2022 年将推出新功能。 Follow below list:请遵循以下列表:

  • Unity catalog (seems that it will exists next to hive metastore and it will be possible to migrate) unity catalog(好像会在 hive metastore 旁边存在,可以迁移)
  • Control metastore, unity creations etc. from admin console,从管理控制台控制元存储、统一创建等,
  • CPU clusters in "create cluster" (similar to SQL endpoints) where you specify how much cpus is needed “创建集群”中的 CPU 集群(类似于 SQL 端点),您可以在其中指定需要多少 CPU
  • Data lineage数据沿袭
  • Delta sharing三角洲共享
  • Delta: primary keys Delta:主键
  • Delta: foreign keys Delta:外键
  • Updated partner connect with many new partners joining更新的合作伙伴与许多新加入的合作伙伴联系
  • Notebooks UI: transformations wizards (like select, drop, groupby from droplist etc.) Notebooks UI:转换向导(如从下拉列表中选择、删除、分组等)
  • New global search新的全局搜索
  • Integration of job service with git作业服务与 git 的集成
  • Jobs monitoring作业监控
  • Repair and rerun failed tasks and pass values between tasks修复并重新运行失败的任务并在任务之间传递值
  • SQL workflows in SQL view SQL 视图中的 SQL 工作流
  • create table enhanced via wizard通过向导增强创建表
  • Delta live tables in GA GA 中的 Delta 实时表
  • Serverless DBSQL无服务器 DBSQL
  • Private links (to VNET and to ExpressRoute) and encryption专用链接(到 VNET 和 ExpressRoute)和加密
  • ML: LightGBM, Prophet Models and Text Feature in Auto ML ML:Auto ML 中的 LightGBM、Prophet 模型和文本特征
  • ML: Feature store integration with Azure MySQL, Azure SQL and CosmosDB ML:与 Azure MySQL、Azure SQL 和 CosmosDB 的功能存储集成
  • ML: Feature store: point in time joins, time-based splits ML:特征存储:时间点连接、基于时间的拆分
  • ML: Feature store API ML:特征存储 API
  • ML: Serverless model serving (enable serving button) with high availability SLA ML:具有高可用性 SLA 的无服务器模型服务(启用服务按钮)
  • ML: one click model deployment into registry ML:一键模型部署到注册表

In 2023 : 2023 年

  • Delta: identity column Delta:身份列
  • Delta: dynamic checkpoints and incremental commits to limit read/write operations with ADLS Delta:动态检查点和增量提交以限制 ADLS 的读/写操作

Refer this link参考这个链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM