fabric-pipeline-express-7 implémente un pipeline Microsoft Fabric Data Factory entièrement événementiel : dès qu'un fichier de suivi de colis est déposé dans OneLake, le pipeline se déclenche automatiquement sans intervention manuelle. Il fusionne les enregistrements reçus dans une table Delta via une opération Upsert sur la clé shipment_id, garantissant qu'aucune ligne n'est dupliquée, même lorsqu'un fichier est rejoué. Une fonction Python hébergée dans Fabric analyse ensuite le nom du fichier et le volume de lignes traitées pour rédiger un compte rendu de vague, qui est publié dans Microsoft Teams. Le projet repose sur quatre activités — Set variable, Copy data, Functions et Microsoft Teams — orchestrées par un déclencheur OneLake, et inclut le code de la fonction, les expressions du pipeline et un guide PDF détaillant chaque étape.
- Windows 10 or Windows 11
- PowerShell 5.1 or newer (already available on Windows)
- Active network connection
- No admin rights needed
-
Event-driven orchestration: A trigger bound to OneLake file-created events watches the designated inbox folder and launches the pipeline automatically the moment a matching file lands. No scheduler, no manual run, no polling loop; the arrival of data is itself the execution signal.
-
Parameterless-by-design entry point: The trigger event carries the file name through to the pipeline, where a variable resolution step coalesces the event payload with an optional manual parameter. The same pipeline supports both automatic and on-demand invocation without code changes or duplicated definitions.
-
Key-based Upsert merge: The copy activity targets a Delta table with Upsert semantics on a single business key. Incoming rows are compared against existing records; absent keys are inserted, present keys are updated in place. Replaying the same file is idempotent and never produces duplicate records, eliminating the need for hand-written MERGE statements or post-load deduplication.
-
Embedded Python reporting function: A user-defined function hosted in the workspace accepts the file name and the row count read by the copy activity, derives the batch timestamp from the file naming convention, classifies load volume against a configurable threshold, and returns a formatted natural-language summary. The function is independently testable and callable from any pipeline in the same workspace.
-
Downstream notification activity: The generated summary is passed directly as the message body of a Teams activity, publishing the batch report to the target channel without intermediate storage or transformation steps.
-
Deterministic file-name parsing: Wave timing is extracted from the trailing numeric segment of the file name and rendered into a human-readable form, keeping the reporting logic decoupled from any external metadata store.
-
Explicit activity chain: The pipeline composes a variable assignment, a copy activity, a function invocation, and a notification activity in a linear, auditable sequence, with each step's output available to the next through the standard activity output contract.
-
Observable end-to-end latency: The interval between file deposit and channel notification is measured in minutes, with each stage individually inspectable in the run history for diagnosis and tuning.
The pipeline is built around a continuous, event-driven sequence composed of four activities and a single trigger. Each stage performs one clearly scoped operation, passing its result forward to the next so that the file name, the row count, and the report text move through the run without manual intervention.
1. Event capture. The trigger TR_Dock_Inbox subscribes to OneLake events on the Files/inbox folder of the LH_Dock lakehouse. It listens for the file-created event type and applies a subject-based filter that accepts only .csv files, so unrelated deposits in the same folder do not start a run. When a matching file appears, the trigger launches PL_Dock_Express and forwards the event payload as input. The same pipeline accepts a file_name parameter, which allows manual runs to follow the identical path.
2. File resolution. The Pick file activity is a Set variable operation that resolves the working file name into the file variable. It evaluates the trigger event first and falls back to the pipeline parameter when no event is present. This coalescing logic means the downstream activities never need to know whether the run was triggered automatically or started by hand.
3. Upsert into Delta. The Upsert shipments activity is a Copy data operation that reads the resolved source path and writes to the shipments Delta table. It is configured with the Upsert write behavior and uses shipment_id as the key column. Incoming rows are compared against the table by key: unknown identifiers are inserted, and existing identifiers are updated in place with the new column values. The activity outputs the number of rows read, which is captured for the reporting stage. Because the merge is keyed, replaying the same file leaves the table unchanged rather than duplicating records.
4. Report generation. The Build report activity invokes the user data function build_report hosted in FN_Dock. It receives the file name and the row count from the previous stage. The Python function derives the wave label from the file name suffix, classifies the load volume against a threshold, and returns a single formatted sentence. Because the logic lives in a published function rather than inline expressions, it can be tested independently and reused by other pipelines in the workspace.
5. Notification. The Post report activity is a Microsoft Teams operation that publishes the string returned by Build report into the target channel. The message content is bound to the function output, so the announcement reflects the actual file and row count of the run that just completed.
The dependency chain between activities is explicit: Pick file feeds Upsert shipments, which feeds Build report, which feeds Post report. No stage polls or schedules; execution propagates from the incoming event to the final message, and the run terminates once the notification is delivered.
The pipeline is designed to run natively inside Microsoft Fabric and depends on the following platform capabilities, all of which must be available in the target workspace.
OneLake and Lakehouse. A Fabric lakehouse (LH_Dock in the reference topology) must host the Files/inbox landing area and the Delta table shipments. The trigger relies on Microsoft.Fabric.OneLake.FileCreated events emitted by the OneLake events subsystem, so the workspace must have event-based triggers enabled and the lakehouse must reside in a capacity that supports them. Files must be .csv and follow the naming convention <prefix>_<YYYY-MM-DD>_<HHMM>.csv; the wave timestamp is parsed from the final underscore-delimited segment.
Fabric Data Factory. The pipeline uses the Set variable, Copy data, Functions and Microsoft Teams activities and a parameter named file_name. The Copy data activity requires a Delta sink with the Upsert action configured on the shipment_id key, which in turn requires the target table to expose that column as a merge key. Replaying an already-processed file is supported and idempotent by design.
User data functions. The build_report function targets the Fabric user data functions runtime with the fabric.functions Python package and the @udf.function() decorator. Parameters are passed in camelCase (fileName, rowsRead) and the function returns a plain string. The function must be published to the workspace before the pipeline can invoke it, and the calling pipeline must be in the same workspace as the function.
Activator. The TR_Dock_Inbox rule listens for OneLake file-created events, filters on the inbox folder and on subject ending in .csv, and forwards the full event payload to the pipeline. The pipeline's Pick file variable resolves the file name via coalesce(pipeline()?.TriggerEvent?.FileName, pipeline().parameters.file_name), so manual runs remain possible by supplying file_name directly.
Microsoft Teams. The Post report activity publishes to a Teams channel and requires the Fabric–Teams integration to be authorized for the workspace identity. Message content is taken from activity('Build report').output.output.
SQL analytics endpoint. The validation queries in this repository run against the lakehouse SQL analytics endpoint and assume the shipments table has been synchronized. Direct Lake or SQL endpoint synchronization latency may delay visibility of newly merged rows.
Data contract. Input files carry six columns — shipment_id, client, destination, weight_kg, status, updated_at — and the status domain is limited to PREPARE, EXPEDIE, LIVRE and RETARD. Files that deviate from this schema or naming convention are not guaranteed to be processed correctly by the Upsert or by the report function.
Capacity and regional constraints. Cross-region workspace configurations and capacities without the required Fabric workloads enabled are not supported. The project assumes a single workspace containing the lakehouse, the user data functions and the pipeline.
Le déclencheur se déclenche-t-il pour tout fichier déposé dans le lakehouse ?
Non. La règle TR_Dock_Inbox filtre les événements sur deux critères cumulatifs : le dossier ciblé, limité à Files/inbox, et l'extension du fichier, dont le sujet doit se terminer par .csv. Un fichier déposé ailleurs dans le lakehouse, ou avec une autre extension, ne lance pas le pipeline. Ce filtrage s'effectue en amont de l'exécution, ce qui évite de consommer une capacité pour des objets non destinés au traitement.
Que se passe-t-il si le même fichier est déposé deux fois ?
L'activité Upsert shipments applique une fusion sur la clé shipment_id. Une ligne dont l'identifiant est déjà présent dans la table Delta remplace la version existante au lieu de s'ajouter. Le rejeu d'un fichier est donc idempotent : le nombre de lignes de la table reste inchangé et aucun doublon n'est créé. La quatrième exécution du tableau de référence illustre ce comportement avec le fichier de 14 h rejoué à l'identique.
Comment le pipeline détermine-t-il le fichier à traiter lorsqu'il est lancé manuellement ?
L'activité Pick file résout le nom de fichier par une expression de coalescence : elle lit d'abord pipeline()?.TriggerEvent?.FileName, puis se rabat sur le paramètre file_name du pipeline. En exécution déclenchée, le nom voyage avec l'événement OneLake et n'est jamais saisi manuellement. En exécution manuelle, l'opérateur renseigne le paramètre. Les deux modes partagent ainsi le même chemin de traitement, sans duplication de logique.
Sur quels types de colonnes la clé d'Upsert peut-elle être définie ?
La clé shipment_id est une colonne scalaire à valeurs uniques, ce qui constitue la condition d'une fusion fiable. L'activité Copy data en mode Upsert compare chaque ligne entrante à la table cible sur cette clé. Une clé composite reste possible si le besoin métier l'exige, à condition que la combinaison de colonnes soit unique dans le fichier source comme dans la table. Une clé non unique produirait des correspondances multiples et un comportement de fusion indéterminé.
Quel est le contrat d'interface de la fonction Python build_report ?
La fonction expose deux paramètres typés, fileName de type chaîne et rowsRead de type entier, et retourne une chaîne. Les noms suivent la convention camelCase attendue par les fonctions de données utilisateur de Fabric. Elle dérive l'heure de la vague à partir du suffixe du nom de fichier, qualifie la charge selon un seuil sur rowsRead, et compose la phrase publiée. La fonction est sans état et sans dépendance externe : elle peut être testée isolément, publiée une fois dans l'espace de travail, et invoquée par n'importe quel pipeline qui en respecte la signature.
Comment le message Teams est-il construit à partir de la sortie de la fonction ?
L'activité Post report référence la sortie de l'activité Functions par l'expression @{activity('Build report').output.output}. La chaîne rédigée par Python est ainsi injectée directement dans le corps du message, sans transformation intermédiaire. Toute modification du format du compte rendu s'effectue donc dans la fonction elle-même, et se propage au canal sans retoucher le pipeline.
Quelles dépendances techniques le projet requiert-il côté Fabric ?
L'exécution suppose un lakehouse avec un dossier Files/inbox et une table Delta cible, une ressource Functions hébergeant la fonction publiée, un pipeline paramétré, une règle Activator abonnée aux événements OneLake, et un canal Teams accessible. Le point de terminaison SQL du lakehouse permet de vérifier l'état de la table après chaque vague. Aucune orchestration planifiée n'est nécessaire : le déclencheur événementiel constitue l'unique point d'entrée en production.
Le comportement est-il reproductible sur un autre espace de travail ?
Oui, à condition de recréer les objets nommés — lakehouse, fonctions, pipeline, règle de déclenchement — et de reporter les expressions fournies dans le fichier data/expressions.txt. Les noms d'objets et les chemins internes doivent être alignés sur la nouvelle topologie. Les jeux de données fournis permettent de rejouer les trois vagues et de retrouver les totaux attendus : 150 colis, 150 identifiants distincts, et la répartition par statut documentée.
The materials in this repository are provided for educational and demonstration purposes only. The dataset shipped with fabric-pipeline-express-7 is entirely fictitious and was constructed solely to exercise the pipeline; it does not represent any real shipment, client, address, or logistics operation, and no correspondence with production data is intended or implied.
The software and accompanying assets are supplied "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, accuracy, and non-infringement. The author makes no guarantee that the pipeline, the Python user data function, the Upsert logic, or the Teams notification will behave identically in another tenant, workspace, capacity, or Fabric runtime version, nor that any documented figure will reproduce exactly outside the reference environment.
The behavior of fabric-pipeline-express-7 depends on external platform components that are outside its control: OneLake event delivery, Activator rule evaluation, the Data Factory runtime, the Delta Lake table format, the Fabric user data functions host, and Microsoft Teams channel publication. Latency, ordering, retry semantics, and event payload shape are governed by those services and may change. The documented end-to-end interval of roughly two minutes is an observation in a single environment, not a service-level commitment.
The Upsert copy merges rows on the declared key. Correctness of the resulting table depends on the uniqueness and stability of that key in the source files. Duplicate keys within a single incoming file, null keys, or key values that change between waves can produce results different from those described. Consumers remain responsible for validating key uniqueness upstream and for reconciling the merged table against their own source of truth.
Event-triggered execution means the pipeline can start without human action. Operators should account for concurrent or replayed events, partial file uploads that satisfy the trigger filter before the file is complete, and repeated processing of the same file. The merge is idempotent with respect to the key, but downstream systems consuming the table or the Teams message should not assume exactly-once delivery of notifications.
Users are responsible for verifying that deployment and operation comply with their organization's data governance, retention, access control, and security policies, including the handling of any data placed in OneLake and the audience of any Teams channel used for reporting. Credentials, connection references, and workspace permissions are managed in the target environment and are not part of this repository.
No liability is accepted for any direct, indirect, incidental, special, or consequential loss or damage arising from the use of, or inability to use, this project or its documentation, including but not limited to loss of data, incorrect reporting, or operational disruption.
Names of products and services referenced in this document are the trademarks or registered trademarks of their respective owners. Their use here is descriptive only and does not imply endorsement, sponsorship, or affiliation with fabric-pipeline-express-7.
fabric-pipeline-express-7 est distribué sous licence MIT. Le texte intégral de la licence accompagne le projet dans le fichier LICENSE à la racine du dépôt et prévaut en cas de divergence avec le présent résumé.
Droits accordés. La licence MIT autorise l'utilisation, la copie, la modification, la fusion, la publication, la distribution, la sous-licence et la vente du logiciel et de sa documentation, sans restriction, y compris à des fins commerciales, sous réserve du maintien de la mention de copyright et du texte de la licence dans toutes les copies ou parties substantielles du logiciel.
Conditions de redistribution. Toute redistribution, sous forme source ou compilée, doit conserver l'avis de copyright original et la clause de non-garantie. Les fichiers de données d'exemple (data/) et la fonction Python build_report sont couverts par la même licence que le reste du dépôt.
Absence de garantie. Le logiciel est fourni « en l'état », sans garantie expresse ou implicite, y compris, mais sans s'y limiter, les garanties de qualité marchande, d'adéquation à un usage particulier et d'absence de contrefaçon. En aucun cas les auteurs ou titulaires du copyright ne sauraient être tenus responsables de toute réclamation, dommage ou autre responsabilité découlant de l'utilisation du logiciel ou des données associées.
Périmètre. La licence couvre l'ensemble du contenu du dépôt : pipeline, expressions, fonction de données utilisateur, jeu de données fictif et documentation. Les services tiers sollicités à l'exécution (Microsoft Fabric, OneLake, Activator, Microsoft Teams) restent régis par leurs propres conditions d'utilisation et ne sont pas couverts par la présente licence.




