模块' dlt'没有属性' table' -Databricks和Delta Live Tables

发布于 2025-01-29 12:23:11 字数 597 浏览 7 评论 0 原文

我是Databricks和Delta Live Tables的新手。我在Python创建Delta Live Table有问题。

”“在此处输入图像描述”

“在此处输入图像说明”

如何从filestore中的json文件中创建delta live表?

I am new to databricks and delta live tables. I have problem with creating delta live table in python.

enter image description here

enter image description here

enter image description here

How to create delta live table from json files in filestore?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

梦在深巷 2025-02-05 12:23:11

它是一个装饰器,所以我认为您还需要一个功能。意思

@dlt.table(comment="your comment")
def get_bronze():
    df=spark.sql("""select * from myDb.MyRegisterdTable""")
    #If you wanna check logs:
    #print("bronze",df.take(5),"end")
    return df

是在银函数中,您可以将其读取为:

@dlt.table
def get_silver():
    df = dlt.read("get_bronze")
    [..do_stuff...]
    return df

也是从屏幕截图中,我不确定,您是作为管道运行的,还是要运行笔记本电脑?后者不起作用。

It is a decorator, so I think you also need a function after. Meaning

@dlt.table(comment="your comment")
def get_bronze():
    df=spark.sql("""select * from myDb.MyRegisterdTable""")
    #If you wanna check logs:
    #print("bronze",df.take(5),"end")
    return df

In silver function then you can read it as:

@dlt.table
def get_silver():
    df = dlt.read("get_bronze")
    [..do_stuff...]
    return df

Also from your screenshots I am not sure, are you running all this as a pipeline or are you trying to run a Notebook? The latter does not work.

最冷一天 2025-02-05 12:23:11

桑德罗的答案应该解决您的问题。对于使用实时桌子摄入JSON文件,您可以在某些用例中查看本文“ rel =“ nofollow noreferrer”> https://medium.com/@chaobioz/create-delta-live-tables-dlt-dlt-dlt-dynamisaly-with-pyspark-e06a718199c8

同样也可以生产,最好将自动装载机作为生产出色地。

Sandro’s answer should solve your problem. For ingesting json files with live tables, you can check this article for some use cases https://medium.com/@chaobioz/create-delta-live-tables-dlt-dynamically-with-pyspark-e06a718199c8

Also if for production, better use auto loader as well.

梦萦几度 2025-02-05 12:23:11
  1. 使用脚本创建笔记本电脑
  2. 创建管道(带有所需的配置)。
  3. 直接启动管道,请勿直接创建笔记本三角洲表。

您可以检查文档本身中提到的此过程。

阅读在要求上方的步骤,我想这会有所帮助。

  1. Create a Notebook with the scripts
  2. Create a Pipeline (With your Required configs).
  3. Start the Pipeline directly, don't run the notebook Delta Tables will be created directly.

You can check this process mentioned in the documentation itself.
https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-quickstart.html

Read the steps just above the requirement, I guess that would help.

2025-02-05 12:23:11

使用Databricks群集,13上方的运行时运行时

Use Databricks cluster, runtime above 13

沙沙粒小 2025-02-05 12:23:11

在导入DLT之前,您可以尝试安装DLT吗?

%PIP安装DLT

Could you try to install dlt before importing it?

%pip install dlt

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文