@dlt.table throws error AttributeError: module 'dlt' has no attribute 'table'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 05:41 AM
Hi Everyone,
I am new to DLT and am trying to run below code to create table dynamically. But I get error "AttributeError: module 'dlt' has no attribute 'table'".
code snippet:
I have the dlt module loaded via pip install
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 07:40 AM
Hey @DE_K , It's hard to follow without some more context, but shouldn't that be live instead of dlt - "select * from live.{0}".format(model_name)", considering you have already created the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 08:06 AM
Hi @YuliyanBogdanov , That piece of code is under @dlt.append_flow which I believe would append the data, the exception section would first create the table. The code follows same path and goes to exception section but throws error at @dlt.table . So if you have any idea as to why its happening, please let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 11:57 PM
Thank You, @DE_K. I see your point. I believe you are using the @dlt.table instead of @dlt.create_table to begin with, since want the table to be created and not define and existing one. (https://community.databricks.com/t5/data-engineering/difference-dlt-table-and-dlt-create-table-decor...). Let me know if this helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 02:54 AM
Hi @YuliyanBogdanov , no luck with that as well. getting same error. Not sure what is it that I am missing.
I installed dlt using pip install dlt. I believe that is the way to go.

