# Python Microsoft Fabric - Letting Fabric pipelines read your local systems

One HTTPS endpoint that notebooks and pipelines read from, with no data gateway.

On this page, a Fabric notebook or pipeline reads a database in your own network through a REST channel that a Zato service publishes over HTTPS. Fabric reads the URL like any other API.

The [on-premise gateway](https://zato.io/docs/dev/examples/cloud/on-premise.html) page describes the same setup for other cloud services.

> **What you need from your Fabric admin**
>
> Nothing from Fabric itself for the service and the channel. For the pipeline, the workspace ID and the lakehouse ID, from the address bar, for the Copy activity's destination.

## The service {#the-service}

A [SQL connection](https://zato.io/docs/dev/examples/sql/index.html) to the local database is created in the Dashboard once. The service takes a `since` time, so a caller reads what changed rather than everything, and declares its output, so the channel returns these four columns.

```python
# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class GetAppointments(Service):

    name = 'appointments.get'
    input = 'since'
    output = 'appointment_id', 'location', 'starts_at', 'status'

    def handle(self):

        conn = self.out.sql['Appointments DB']

        query = """
        select appointment_id, location, starts_at, status
        from appointments
        where updated_at >= :since
        order by starts_at
        """

        params = {'since': self.request.input.since}
        result = conn.execute(query, params)

        self.response.payload = result
```

## The channel {#the-channel}

Under `Connections → REST → Channels`, create the channel at `/api/appointments` with an API key. In enmasse YAML:

```yaml
security:
  - name: Fabric Reader Key
    type: apikey
    username: fabric-reader
    password: Zato_Enmasse_Env.FabricReaderKey

channel_rest:
  - name: api.appointments
    service: appointments.get
    url_path: /api/appointments
    security: Fabric Reader Key
    data_format: json
```

Any caller with the key reads the rows over HTTPS:

```bash
curl -H "X-API-Key: <the key>" "https://api.example.com/api/appointments?since=2026-03-11T00:00:00Z"
```

```json
[
  {"appointment_id": "APT-2205", "location": "Riverside",   "starts_at": "2026-03-11T13:00:00Z", "status": "Scheduled"},
  {"appointment_id": "APT-2206", "location": "Oak Hill",    "starts_at": "2026-03-11T13:30:00Z", "status": "Checked in"},
  {"appointment_id": "APT-2207", "location": "Maple Grove", "starts_at": "2026-03-11T14:00:00Z", "status": "Cancelled"},
  {"appointment_id": "APT-2208", "location": "Riverside",   "starts_at": "2026-03-11T15:00:00Z", "status": "Scheduled"}
]
```

## From a notebook {#from-a-notebook}

A notebook reads the endpoint like any HTTPS API and puts the rows into a DataFrame:

```python
# In a Microsoft Fabric notebook
import requests

url = 'https://api.example.com/api/appointments'
headers = {'X-API-Key': '<the key>'}
params = {'since': '2026-03-11T00:00:00Z'}

response = requests.get(url, headers=headers, params=params)
appointments = response.json()

frame = spark.createDataFrame(appointments)
display(frame)
```

## From a pipeline {#from-a-pipeline}

A pipeline does the same without code. Add a Copy activity, choose REST as the source with the channel's URL and the `X-API-Key` header, and the lakehouse as the destination with `appointments` as the table. Each run reads the endpoint and writes what it got into the table.

After the run, the table in the lakehouse holds the same four rows the endpoint returned:

## See also {#see-also}

- [On-premise gateway](https://zato.io/docs/dev/examples/cloud/on-premise.html) - The same setup for Power Automate and Azure
- [Picking up results when a notebook finishes](https://zato.io/docs/dev/examples/cloud/fabric/notebook-results.html) - A pipeline calling a REST channel to say it is done
- [Loading data into tables](https://zato.io/docs/dev/examples/cloud/fabric/loading-tables.html) - The other direction, a service pushing rows into Fabric

## Learn more {#learn-more}

- [Development documentation](https://zato.io/docs/dev/) - Everything about writing services, in one place
- [Requests and responses](https://zato.io/docs/dev/request-response/) - What a service receives, what it returns and how to shape both
- [Integration examples](https://zato.io/docs/dev/examples/) - Ready-made code for the systems you are likely to connect to
- [IDE and debugging](https://zato.io/docs/dev/ide/) - Write services in the Dashboard or in your own editor
- [Data models](https://zato.io/docs/dev/model/) - Declare inputs and outputs and have them validated for you
- [In-depth API tutorial](https://zato.io/tutorials/main/01.html) - The full platform tutorial, from installation to production patterns
