Skip to content

Commit

Permalink
Change experimental_python_types to legacy_primitive_types. Invert lo…
Browse files Browse the repository at this point in the history
…gic behind interpreting this parameter.
  • Loading branch information
damian3031 committed Dec 30, 2022
1 parent 8affa61 commit 665f8d3
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 92 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ engine = create_engine(
connect_args={
"session_properties": {'query_max_run_time': '1d'},
"client_tags": ["tag1", "tag2"],
"experimental_python_types": True,
"roles": {"catalog1": "role1"},
}
)
Expand All @@ -126,16 +125,14 @@ engine = create_engine(
'trino://user@localhost:8080/system?'
'session_properties={"query_max_run_time": "1d"}'
'&client_tags=["tag1", "tag2"]'
'&experimental_python_types=true'
'&roles={"catalog1": "role1"}'
)

# or using the URL factory method
engine = create_engine(URL(
host="localhost",
port=8080,
client_tags=["tag1", "tag2"],
experimental_python_types=True
client_tags=["tag1", "tag2"]
))
```

Expand Down Expand Up @@ -442,8 +439,9 @@ exits the *with* context and the queries succeed, otherwise

## Improved Python types

If you enable the flag `experimental_python_types`, the client will convert the results of the query to the
By default, the client will convert the results of the query to the
corresponding Python types. For example, if the query returns a `DECIMAL` column, the result will be a `Decimal` object.
If you want to disable this behaviour, set flag `legacy_primitive_types` to `True`.

Limitations of the Python types are described in the
[Python types documentation](https://docs.python.org/3/library/datatypes.html). These limitations will generate an
Expand All @@ -456,7 +454,6 @@ import pytz
from datetime import datetime

conn = trino.dbapi.connect(
experimental_python_types=True,
...
)

Expand Down
Loading

0 comments on commit 665f8d3

Please sign in to comment.