Skip to content

Commit 79fab40

Browse files
fix lint
1 parent 851f1d1 commit 79fab40

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

ingestr/src/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
ArrowMemoryMappedSource,
2929
AsanaSource,
3030
AttioSource,
31+
CassandraSource,
3132
ChessSource,
3233
DynamoDBSource,
3334
ElasticsearchSource,
@@ -61,7 +62,6 @@
6162
StripeAnalyticsSource,
6263
TikTokSource,
6364
ZendeskSource,
64-
CassandraSource,
6565
)
6666

6767
SQL_SOURCE_SCHEMES = [

ingestr/src/sources.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,23 +2506,41 @@ def dlt_source(self, uri: str, table: str, **kwargs):
25062506
).with_resources(table_name)
25072507
except ResourcesNotFoundError:
25082508
raise UnsupportedResourceError(table_name, "Solidgate")
2509-
2509+
2510+
25102511
class CassandraSource:
25112512
def handles_incrementality(self) -> bool:
25122513
return False
25132514

25142515
def dlt_source(self, uri: str, table: str, **kwargs):
25152516
parsed_uri = urlparse(uri)
2516-
query_params = parse_qs(parsed_uri.query)
2517-
username = query_params.get("username")
2518-
if username is not None:
2517+
username = parsed_uri.username
2518+
if username:
25192519
username = username[0]
2520-
password = query_params.get("password")
2521-
if password is not None:
2520+
2521+
password = parsed_uri.password
2522+
if password:
25222523
password = password[0]
2523-
host = query_params.get("host")[0]
2524-
port = query_params.get("port")[0]
2525-
keyspace = query_params.get("keyspace")[0]
2526-
2524+
2525+
host = parsed_uri.hostname
2526+
if not host:
2527+
raise MissingValueError("host", "Cassandra")
2528+
2529+
port = parsed_uri.port
2530+
if not port:
2531+
port = 9042
2532+
2533+
keyspace = parsed_uri.path.lstrip("/")
2534+
if not keyspace:
2535+
raise MissingValueError("keyspace", "Cassandra")
2536+
25272537
from ingestr.src.cassandra import cassandra_source
2528-
return cassandra_source(host=host, port=port, keyspace=keyspace, table=table, username=username, password=password)
2538+
2539+
return cassandra_source(
2540+
host=host,
2541+
port=port,
2542+
keyspace=keyspace,
2543+
table=table,
2544+
username=username,
2545+
password=password,
2546+
).with_resources("fetch_data")

0 commit comments

Comments
 (0)