Skip to content

Commit 3291506

Browse files
mdesmethashhar
authored andcommitted
Refactor TrinoStatus into @dataclass
1 parent 7179145 commit 3291506

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

trino/client.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import threading
4545
import urllib.parse
4646
import warnings
47+
from dataclasses import dataclass
4748
from datetime import date, datetime, time, timedelta, timezone, tzinfo
4849
from decimal import Decimal
4950
from time import sleep
@@ -290,16 +291,16 @@ def get_roles_values(headers, header):
290291
]
291292

292293

293-
class TrinoStatus(object):
294-
def __init__(self, id, stats, warnings, info_uri, next_uri, update_type, rows, columns=None):
295-
self.id = id
296-
self.stats = stats
297-
self.warnings = warnings
298-
self.info_uri = info_uri
299-
self.next_uri = next_uri
300-
self.update_type = update_type
301-
self.rows = rows
302-
self.columns = columns
294+
@dataclass
295+
class TrinoStatus:
296+
id: str
297+
stats: Dict[str, str]
298+
warnings: List[Any]
299+
info_uri: str
300+
next_uri: Optional[str]
301+
update_type: Optional[str]
302+
rows: List[Any]
303+
columns: List[Any]
303304

304305
def __repr__(self):
305306
return (

0 commit comments

Comments
 (0)