Chais opened a new issue, #62459:
URL: https://github.com/apache/airflow/issues/62459

   ### Apache Airflow version
   
   3.1.7
   
   ### If "Other Airflow 3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   When configuring a Tableau connection via the web frontend offers a `schema` 
field. In `TableauHook.__init__` however, it is never used.  
   The `tableauserverclient.Server` is constructed from `self.conn.host` only:
   ```py
   self.server = Server(self.conn.host)
   ```
   `Server.__init__` on the other hand expects a schema specifier as part of 
the `server_adress` param, as evidenced by this snippet:
   ```py
   if not server_address.startswith("http://";) and not 
server_address.startswith("https://";):
       server_address = "http://"; + server_address
   ```
   As a result `TableauHook` will only create HTTP connections if the schema is 
configured "properly."
   
   As a workaround the schema can be included in the host field (e.g. 
`https://tableau.example.com`) or with escaped schema separator in a URI 
variable (`https%3A%2F%2Ftableau.example.com`), which will both result in it 
being passed to `Server.__init__` and yielding the expected result. However, 
this is not obvious and should not be encouraged, imo.
   
   ### What you think should happen instead?
   
   Since the Schema field is offered it should also be effective.  
   Something like
   ```py
   self.server = Server(f"{self.conn.schema}://{self.conn.host}")
   ```
   should do the trick.
   
   ### How to reproduce
   
   1. Have a Tableau server accessible via HTTPS only.
   2. Configure a connection to it, setting the schema to https (e.g. 
`AIRFLOW_CONN_TABLEAU_TEST=tableau://username:[email protected]/https`)
   3. Get an error like this when trying to use it:
      ```
      {base.py:84} INFO - Retrieving connection 'tableau_test'
      {server.py:263} INFO - Could not get version info from server: <class 
'requests.exceptions.ConnectionError'>HTTPConnectionPool(host='tableau.example.com',
 port=80): Max retries exceeded with url: /api/2.4/serverInfo (Caused by 
NewConnectionError('<urllib3.connection.HTTPConnection object at 
0x7f252b74eba0>: Failed to establish a new connection: [Errno 111] Connection 
refused'))
      ```
      Notice the `port=80`.
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-tableau==5.1.0
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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