Skip to content

Commit ebe7f79

Browse files
committed
Fix some usages of event. and update exceptions, Table usages
1 parent 718f99d commit ebe7f79

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

flowmachine/flowmachine/core/server/query_schemas/custom_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class EventTypes(fields.List):
5656
"""
5757
A list of strings representing an event type, for example "calls", "sms", "mds", "topups".
5858
59-
When deserialised, will be deduped, and prefixed with "events."
59+
When deserialised, will be deduped.
6060
"""
6161

6262
def __init__(

flowmachine/flowmachine/features/subscriber/active_subscribers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ActiveSubscribers(ExposedDatetimeMixin, Query):
8080
total_major_periods=4,
8181
minor_period_threshold=1,
8282
major_period_threshold=3,
83-
tables=["events.calls"],
83+
tables=["calls"],
8484
)
8585
8686
Returns subscribers that were active in at least two ten minute intervals within half an hour,
@@ -94,7 +94,7 @@ class ActiveSubscribers(ExposedDatetimeMixin, Query):
9494
minor_period_threshold=2,
9595
major_period_threshold=3,
9696
period_unit="minutes",
97-
tables=["events.calls"],
97+
tables=["calls"],
9898
)
9999
100100

flowmachine/flowmachine/features/utilities/event_table_subset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class EventTableSubset(Query):
4040
This will subset the query only with these hours, but
4141
across all specified days. Or set to 'all' to include
4242
all hours.
43-
table : str, default 'events.calls'
43+
table : str, default 'calls'
4444
schema qualified name of the table which the analysis is
4545
based upon
4646
subscriber_identifier : {'msisdn', 'imei'}, default 'msisdn'

flowmachine/flowmachine/features/utilities/sets.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ class UniqueSubscribers(Query):
4646
table : str, default 'all'
4747
Table on which to perform the query. By default it will look
4848
at ALL tables, which are any tables with subscriber information
49-
in them, specified via subscriber_tables in flowmachine.yml. Otherwise
50-
you need to specify a full table (with a schema) such as
51-
'events.calls'.
49+
in them, specified via subscriber_tables in flowmachine.yml.
5250
subscriber_identifier : {'msisdn', 'imei'}, default 'msisdn'
5351
Either msisdn, or imei, the column that identifies the subscriber.
5452
subscriber_subset : str, list, flowmachine.core.Query, flowmachine.core.Table, default None

flowmachine/tests/test_active_subscribers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_active_subscribers_one_day(get_dataframe):
1919
total_major_periods=1,
2020
minor_period_threshold=3,
2121
major_period_threshold=1,
22-
tables=["events.calls"],
22+
tables=["calls"],
2323
)
2424
out = get_dataframe(active_subscribers).iloc[0:5]
2525
print(out)
@@ -44,7 +44,7 @@ def test_active_subscribers_many_days(get_dataframe):
4444
total_major_periods=4,
4545
minor_period_threshold=1,
4646
major_period_threshold=3,
47-
tables=["events.calls"],
47+
tables=["calls"],
4848
)
4949
out = get_dataframe(active_subscribers).iloc[0:5]
5050
print(out)
@@ -72,7 +72,7 @@ def test_active_subscribers_custom_period(get_dataframe):
7272
minor_period_threshold=2,
7373
major_period_threshold=3,
7474
period_unit="minutes",
75-
tables=["events.calls"],
75+
tables=["calls"],
7676
)
7777
assert len(active_subscribers.major_period_queries) == 4
7878
assert active_subscribers.major_period_queries[2].start == "2016-01-01 21:00:00"

flowmachine/tests/test_query_union.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_union_raises_with_mismatched_columns():
4444
"""
4545
with pytest.raises(ValueError):
4646
Table(schema="events", name="calls", columns=["msisdn"]).union(
47-
Table(schema="events", name="calls")
47+
Table(schema="events", name="calls", columns=["id"])
4848
)
4949

5050

flowmachine/tests/test_random.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest
1212
import pickle
1313

14+
from flowmachine.core.errors.flowmachine_errors import PreFlightFailedException
1415
from flowmachine.core.mixins import GraphMixin
1516
from flowmachine.features import daily_location, Flows
1617
from flowmachine.features.utilities.sets import UniqueSubscribers
@@ -233,7 +234,7 @@ def test_system_rows_fail_with_inheritance():
233234
"""
234235
Test whether the system row method fails if the subscriber queries for random rows on a parent table.
235236
"""
236-
with pytest.raises(ValueError):
237+
with pytest.raises(PreFlightFailedException):
237238
df = (
238239
Table(name="events.calls", columns=["msisdn"])
239240
.random_sample(size=8, sampling_method="system_rows")

0 commit comments

Comments
 (0)