Skip to content

Commit 38ba50f

Browse files
authored
doc: Add password sanitisation in readme (#47)
1 parent 7d3993c commit 38ba50f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ To override the API URL (e.g. for dev testing):
4040
export FIREBOLT_BASE_URL=<your_url>
4141
```
4242

43+
If your password contains % or / characters they need to be sanitised as per https://docs.sqlalchemy.org/en/14/core/engines.html#database-urls
44+
```python
45+
my_pass = "0920%/2"
46+
import urllib.parse
47+
new_pass = urllib.parse.quote_plus(my_pass)
48+
```
49+
4350
## Quick Start
4451

4552
```python
53+
import urllib.parse
4654
from sqlalchemy import create_engine
4755

48-
engine = create_engine("firebolt://email@domain:password@sample_database/sample_engine")
56+
password = urllib.parse.quote_plus("your_password_here")
57+
engine = create_engine("firebolt://email@domain:" + password + "@sample_database/sample_engine")
4958
connection = engine.connect()
5059

5160
connection.execute("CREATE FACT TABLE example(dummy int) PRIMARY INDEX dummy")
@@ -58,10 +67,12 @@ for item in result.fetchall():
5867
### [AsyncIO](https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.html) extension
5968

6069
```python
70+
import urllib.parse
6171
from sqlalchemy import text
6272
from sqlalchemy.ext.asyncio import create_async_engine
6373

64-
engine = create_async_engine("asyncio+firebolt://email@domain:password@sample_database/sample_engine")
74+
password = urllib.parse.quote_plus("your_password_here")
75+
engine = create_async_engine("asyncio+firebolt://email@domain:" + password + "@sample_database/sample_engine")
6576

6677
async with engine.connect() as conn:
6778

0 commit comments

Comments
 (0)