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 28, 2022
1 parent 8affa61 commit fd28548
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 91 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ engine = create_engine(
connect_args={
"session_properties": {'query_max_run_time': '1d'},
"client_tags": ["tag1", "tag2"],
"experimental_python_types": True,
"legacy_primitive_types": True,
"roles": {"catalog1": "role1"},
}
)
Expand All @@ -126,7 +126,7 @@ engine = create_engine(
'trino://user@localhost:8080/system?'
'session_properties={"query_max_run_time": "1d"}'
'&client_tags=["tag1", "tag2"]'
'&experimental_python_types=true'
'&legacy_primitive_types=true'
'&roles={"catalog1": "role1"}'
)

Expand All @@ -135,7 +135,7 @@ engine = create_engine(URL(
host="localhost",
port=8080,
client_tags=["tag1", "tag2"],
experimental_python_types=True
legacy_primitive_types=True
))
```

Expand Down Expand Up @@ -442,8 +442,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 +457,6 @@ import pytz
from datetime import datetime

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

Expand Down
Loading

0 comments on commit fd28548

Please sign in to comment.