farrukh-t commented on issue #42248:
URL: https://github.com/apache/airflow/issues/42248#issuecomment-2730927692

   > I have been working on this and I think that this issue is that you are 
using resource="tasks" instead of resource="task" and I am not sure 
resource="tasks" is a valid resource. Are you sure you mean to use 
resource="tasks"?
   
   @aarochuk I'm pretty sure it should be `"tasks"`, not `"task"`. There is a 
dictionary `RESOURCE_METHODS` defined on [line 
32](https://github.com/apache/airflow/blob/a5d0a63d8784d7f4100a4770748c783261968e3c/airflow/providers/tableau/operators/tableau.py#L32C1-L32C18):
   
   <img width="367" alt="Image" 
src="https://github.com/user-attachments/assets/eec0f592-ed1c-4054-89d9-6fb327002036";
 />
   
   Keys from this dictionary are used to validate the value of `resource` 
passed to `TableauOperator`:
   
   <img width="842" alt="Image" 
src="https://github.com/user-attachments/assets/bc43519c-411a-4f18-8d78-fbd9988de247";
 />
   
   If you do pass `resource="task"` instead, Airflow will raise an error:
   ```log
   airflow.exceptions.AirflowException: Resource not found! Available 
Resources: dict_keys(['datasources', 'groups', 'projects', 'schedule', 'sites', 
'subscriptions', 'tasks', 'users', 'workbooks'])
   ```
   
   > In addition can you provide the full command you used to create the 
TableauOperator
   
   Sure, this should be enough to reproduce the bug, just make sure you replace 
the placeholders with an actual task uuid and a Tableau connection id:
   
   ```python
   from airflow import DAG
   from airflow.providers.tableau.operators.tableau import TableauOperator
   
   with DAG(dag_id="debug_tableau") as dag:
       TableauOperator(
           task_id="run_tableau_task",
           resource="tasks",
           method="run",
           find="<replace_with_your_tableau_task_uuid>",
           tableau_conn_id="<replace_with_your_tableau_connection_id>",
       )
   ```
   Failed task's logs:
   ```log
   [2025-03-17, 20:41:20 UTC] {base.py:84} INFO - Using connection ID 
'tableau_conn' for task execution.
   [2025-03-17, 20:41:20 UTC] {server.py:246} INFO - versions: 3.21, 2.4
   [2025-03-17, 20:41:20 UTC] {auth_endpoint.py:91} INFO - Signed into 
https://REDACTED/ as user with id REDACTED
   [2025-03-17, 20:41:20 UTC] {auth_endpoint.py:115} INFO - Signed out
   [2025-03-17, 20:41:20 UTC] {taskinstance.py:441} ▼ Post task execution logs
   [2025-03-17, 20:41:20 UTC] {taskinstance.py:2890} ERROR - Task failed with 
exception
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 465, in _execute_task
       result = _execute_callable(context=context, **execute_callable_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 432, in _execute_callable
       return execute_callable(context=context, **execute_callable_kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/baseoperator.py",
 line 400, in wrapper
       return func(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/tableau/operators/tableau.py",
 line 118, in execute
       response = method(resource_id)
                  ^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/tableauserverclient/server/endpoint/endpoint.py",
 line 274, in wrapper
       return func(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/tableauserverclient/server/endpoint/tasks_endpoint.py",
 line 134, in run
       if not task_item.id:
              ^^^^^^^^^^^^
   AttributeError: 'str' object has no attribute 'id'
   [2025-03-17, 20:41:20 UTC] {taskinstance.py:1205} INFO - Marking task as 
FAILED. dag_id=debug_tableau, task_id=run_tableau_task, 
execution_date=20250317T204115, start_date=20250317T204119, 
end_date=20250317T204120
   [2025-03-17, 20:41:20 UTC] {standard_task_runner.py:110} ERROR - Failed to 
execute job 3 for task run_tableau_task ('str' object has no attribute 'id'; 
20498)
   [2025-03-17, 20:41:20 UTC] {local_task_job_runner.py:240} INFO - Task exited 
with return code 1
   [2025-03-17, 20:41:20 UTC] {taskinstance.py:3482} INFO - 0 downstream tasks 
scheduled from follow-on schedule check
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to