-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue when parsing dbt models #57
Comments
Hey I am getting the same issue. Maybe it has to do with the model being ephemeral, since that's what I am experiencing as well. |
Perhaps @owlas or @jaypeedevlin may know if this is intentional? Sorry to tag directly, but the issue is getting stale and I would like to be able to generate lkml from my dbt project. Thanks in advance 🙏 |
Ephemeral models don’t actually exist, they get imported into downstream models as CTEs. Because of this they can’t be queried directly by dbt2looker (nor looker itself, for that matter). My guess is that dbt2looker needs some special handling of ephemeral models that doesn’t currently exist. |
Hey @jaypeedevlin - thanks for the swift response. I'm not looking to have the ephemeral model generated to lkml. I will only make lkml files out of the estuary "final" dbt models. But it appears that the very existence of an ephemeral model in my dbt project is acting as a blocker for dbt2looker to parse the models - even if that ephemeral model is not tagged with the tag used in the "dbt2looker run". I will have a try now by tagging only those models that I want to expose as lkml. |
Nope, unfortunately that did not have positive affect. I tagged a single dbt model that I would like to generate lkml for (in model config, Sigh 😓 |
@lewisosborne I was running into the same issue, I bypassed it by deleting that ephemeral tag at the top and then re-running I am running into a different error afterwards where I am seeing Let me know if my initial suggestion gets you past the issue with the ephemeral model. |
So yesterday I was modding the code and was able to get past the Since the parser uses the manifest.json file, a node has its materialization in the config object: "config": {
"enabled": true,
"alias": null,
"schema": "staging",
"database": null,
"tags": [],
"meta": {},
"materialized": "ephemeral",
"persist_docs": {},
"quoting": {},
"column_types": {},
"full_refresh": null,
"on_schema_change": "ignore",
"bind": false,
"post-hook": [],
"pre-hook": []
}, If the class DbtNode(BaseModel):
unique_id: str
resource_type: str
config: Dict[str, Any] then the def parse_models(raw_manifest: dict, tag=None) -> List[models.DbtModel]:
manifest = models.DbtManifest(**raw_manifest)
all_models: List[models.DbtModel] = [
node
for node in manifest.nodes.values()
if node.resource_type == 'model' and node.config['materialized'] != 'ephemeral'
]
# Empty model files have many missing parameters
for model in all_models:
if not hasattr(model, 'name'):
logging.error('Cannot parse model with id: "%s" - is the model file empty?', model.unique_id)
raise SystemExit('Failed')
if tag is None:
return all_models
return [model for model in all_models if tags_match(tag, model)] which should ensure the list of models only contains |
Hey, is there a definitive solution for this? Would the solution proposed by @boludo00 be viable to be included in a release? |
I also suggest the tag filtering to be done before the loop on all_models |
Suggestion for def parse_models(raw_manifest: dict, tag=None) -> List[models.DbtModel]:
manifest = models.DbtManifest(**raw_manifest)
all_models: List[models.DbtModel] = [
node
for node in manifest.nodes.values()
if node.resource_type == 'model' and node.config['materialized'] != 'ephemeral'
]
if tag is not None:
all_models = [model for model in all_models if tags_match(tag, model)]
# Empty model files have many missing parameters
for model in all_models:
if not hasattr(model, 'name'):
logging.error('Cannot parse model with id: "%s" - is the model file empty?', model.unique_id)
raise SystemExit('Failed')
return all_models |
Is it a general rule currently that dbt2Looker does not work when you have ephemeral models? I also get the error message |
Hi folks, I installed the tool locally after running into this issue with ephemeral models. I was able to get the solution developed by commenters above to work for me. As you can see, I have opened a PR to incorporate this into I don't think there's a test suite to run this against, is there? I can tell you that |
Hey folks!
I've just run 'dbt2looker' in my local dbt repo folder, and I receive the following error:
The model file itself (pictured below) is not empty, therefore I am not sure what the issue with parsing this model dbt2looker appears to have. It is not materialised as a table or view, it is utilised by dbt as ephemeral - is that of importance when parsing files in the project? I've also tried running dbt2looker on a limited subset of dbt models via a tag, the same error appears. Any help is greatly appreciated!
Other details:
dbt 1.0.0
[email protected]
The text was updated successfully, but these errors were encountered: