Skip to content

Commit

Permalink
use urllib.parse() in sqlalchemy engine creation. Fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
christopeak committed May 9, 2024
1 parent 2b79331 commit ada51a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion psrcelmerpy/conn/connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from . import auth
import sqlalchemy
import pandas as pd
import urllib

class Connection:

Expand Down Expand Up @@ -42,7 +43,8 @@ def _create_engine(self):
self.server_name,
self.database_name
)
self.engine = sqlalchemy.create_engine("mssql+pyodbc:///?odbc_connect=%s" % conn_string)
params = urllib.parse.quote_plus(conn_string)
self.engine = sqlalchemy.create_engine("mssql+pyodbc:///?odbc_connect=%s" % params)

except Exception as e:
print(e.args[0])
Expand Down
1 change: 0 additions & 1 deletion psrcelmerpy/conn/elmer_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def stage_table(self, df, table_name):
The data frame to write to the database
table_name : str
The name that the new staging table is to have.
"""
try:
engine = self.engine
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
install_requires=['pandas',
#'scipy==1.10.1',
'pyodbc',
'urllib',
'sqlalchemy',
'geopandas',
'shapely']
Expand Down

0 comments on commit ada51a6

Please sign in to comment.