Skip to content
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

SQL Server PyODBC URL escaped connection string not saved properly #236

Closed
duffn opened this issue Apr 1, 2016 · 3 comments
Closed

SQL Server PyODBC URL escaped connection string not saved properly #236

duffn opened this issue Apr 1, 2016 · 3 comments
Labels
inactive Inactive for >= 30 days

Comments

@duffn
Copy link

duffn commented Apr 1, 2016

Per the SQLAlchemy documentation here http://docs.sqlalchemy.org/en/rel_1_0/dialects/mssql.html#pass-through-exact-pyodbc-string, you can pass an exact PyODBC connection string, though it must be URL escaped. This works when you create a datasource and click TEST CONNECTION, but does not save the URL escaped connection string so does not subsequently work.

  1. Enter a properly escaped connection string at http://localhost:8088/databaseview/add.
import urllib

quoted = urllib.quote_plus(
    'DRIVER={FreeTDS};SERVER=myserver;PORT=1433;'
    'DATABASE=mydatabase;UID=myuser;PWD=mypassword;TDS_Version=8.0')
print 'mssql+pyodbc:///?odbc_connect={quoted}'.format(quoted=quoted)
# The escaped connection string to use
# mssql+pyodbc:///?odbc_connect=DRIVER%3D%7BFreeTDS%7D%3BSERVER%3Dmyserver%3BPORT%3D1433%3BDATABASE%3Dmydatabase%3BUID%3Dmyuser%3BPWD%3Dmypassword%3BTDS_Version%3D8.0
  1. Click TEST CONNECTION and the connection is successful.
  2. Save the connection.
  3. Now, edit the connection. The connection string is not escaped, therefore does not work
# Connection string after saving and reopening.
mssql+pyodbc:///?odbc_connect=DRIVER={FreeTDS};SERVER=myserver;PORT=1433;DATABASE=mydatabase;UID=myuser;PWD=mypassword;TDS_Version=8.0

SQL Server Enterprise 2012
caravel==0.8.4
pyodbc==3.0.10

@duffn duffn changed the title SQL Server url SQL Server PyODBC URL escaped connection string not saved properly Apr 1, 2016
@mistercrunch
Copy link
Member

here's the relevant, related code:
https://github.com/airbnb/caravel/blob/master/caravel/views.py#L134

Unfortunately I probably won't have time to get to this quickly, I'm happy reviewing PRs though.

@marlesson
Copy link

I have the same problem. What was your solution @duffn ?

@duffn
Copy link
Author

duffn commented Nov 8, 2018

@marlesson I did not come up with a solution, I'm afraid.

@kristw kristw added the inactive Inactive for >= 30 days label Mar 20, 2019
@stale stale bot closed this as completed Apr 11, 2019
graceguo-supercat pushed a commit to graceguo-supercat/superset that referenced this issue Oct 4, 2021
* feat: add .getLegendInformation()

* fix: lint

* test: add unit test

* feat: revise how legend information is computed

* fix: address comments
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
* feat: add .getLegendInformation()

* fix: lint

* test: add unit test

* feat: revise how legend information is computed

* fix: address comments
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
* feat: add .getLegendInformation()

* fix: lint

* test: add unit test

* feat: revise how legend information is computed

* fix: address comments
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
* feat: add .getLegendInformation()

* fix: lint

* test: add unit test

* feat: revise how legend information is computed

* fix: address comments
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
* feat: add .getLegendInformation()

* fix: lint

* test: add unit test

* feat: revise how legend information is computed

* fix: address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

4 participants