SQL Tile - not able to reference CTE name in itself when using recursion

jhale
jhale Member

I am trying to do a fairly simple recursion cte to navigate an employee hierarchy and assign an integer "level" to each employee based on their place in the org. I am using a SQL tile in a Magic ETL. I am getting an error from Domo "Table Not Found: hierarchytable". This I believe is referencing the FROM hierarchytable as eh portion in the recursive section of the cte. Can anyone help me figure out why I am getting this error and how to make this work?

My full code:

image.png
Tagged:

Best Answer

  • ArborRose
    ArborRose Coach
    Answer ✓

    I'm going to venture a guess and say you expecting too much from the SQL tile. When it was introduced to us, we were told it would have limits. Having the SQL tile reference itself isn't something I'd expect it to do.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

Answers

  • ArborRose
    ArborRose Coach
    Answer ✓

    I'm going to venture a guess and say you expecting too much from the SQL tile. When it was introduced to us, we were told it would have limits. Having the SQL tile reference itself isn't something I'd expect it to do.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • You can use Domo’s Magic ETL to simulate recursion if your hierarchy isn't too deep or large.

    1. Filter rows where ManagerID IS NULL (top-level).
    2. Join the result to the hierarchy where ManagerID = EmployeeID.

    Repeat the above as multiple steps (one per level).Append each level's result together. You’ll be limited by the maximum depth you hardcode in ETL.

    Or, if you control source data, process outside Domo. And import the result into Domo.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • jhale
    jhale Member

    Thanks, I wasn't sure what the limits were. The supported functions documentation I've seen doesn't mention CTEs at all, though "some" are supported.