how to create one polymorphic model
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 12/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- stream-processing
Rechercherichtung
The request centres on the polymorphic_fields=True option of faust.Record and on passing such a model as value_type to app.topic, so start by finding where Record options and topic value deserialization are handled. Before any change, decide what the maintainers want: the issue asks whether this is feasible and never states a design, and it has been open for about 1,290 days with no decision. Done would mean a written design agreed in the thread, then a test that deserializes a type-tagged event into the matching subclass.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
I want to be able to process 1 event that can have multiple schemas based on type.
for example
class Event(faust.Record, serializer="json"):
track_id: str
class InsertDataEvent(Event):
file_path: str
type: str = "INSERT"
class CreateTableEvent(Event):
table_name: str
type: str = "CREATE_TABLE"
class PolyEvent(faust.Record, polymorphic_fields=True):
...
And when I process the event, I want it to automatically be parsed by the type, and validated against the leaf class (AKA CreateTableEvent or InsertDataEvent).
ingestion_topic = app.topic("my-topic", key_type=str, value_type=PolyEvent)
@app.agent(channel=ingestion_topic)
async def process(stream) -> None:
async for value in stream.events():
event = value.value
if event.type == "INSERT":
insert_data(event.file_path)
if event.type == "CREATE_TABLE":
create_table(event.table_name)
Is this feasible? how would I write PolyEvent in that case?
Checklist
- I have included information about relevant versions
- I have verified that the issue persists when using the
masterbranch of Faust.
Versions
- Python version -
3.11.0 - Faust version -
0.10.3
- Vorherrschende Sprache
- Python
- Sterne
- 1.9k
- Forks
- 205
- Ø Merge
- 2 Std. 2 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus faust-streaming/faust
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
faust-streaming/faust#804 ·
-
scripts/install script forces use of ./venv virtualenv, impossible to use with virtualenvwrapperOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 62/100
faust-streaming/faust#28 · 1 Kommentar ·
-
[BUG] SASL PLAINTEXT producer initialization fails : missing sasl_plain_username/passwordEvtl. vergeben @wbarnha hat das vor 56 Tagen übernommen. Offen
faust-streaming/faust#794 · 2 Kommentare · 1 Reaktion · 2 zugewiesene Personen ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 18/100
faust-streaming/faust#670 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 18/100
faust-streaming/faust#666 ·
Alle Issues in faust-streaming/faust
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
ActivityWatch/docs#223 ·
-
[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier captureEvtl. vergeben @jianyx1 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
volcengine/OpenViking#8354 ·
Maintainer antworten meist innerhalb von 1 Tag
-
comp/tools P2 tool/skills type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NousResearch/hermes-agent#159541 ·
Maintainer antworten meist innerhalb von 1 Tag
-
multilabel_margin_loss returns an unwritten scalar for an empty CPU batch with reduction='sum'Offenbot-triaged module: correctness (silent) module: cpu module: empty tensor module: loss triage review
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 80/100
Maintainer antworten meist innerhalb von 1 Tag
-
request-theme
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
LizardByte/ThemerrDB#10167 · 1 Kommentar ·