CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-apache-airflow-providers-ftp

Provider package for Apache Airflow that enables FTP file transfer protocol operations including hooks, operators, and sensors for workflow integration.

84

1.06x
Overview
Eval results
Files

task.mdevals/scenario-1/

FTP Directory Metadata Extractor

Build a tool that connects to an FTP server and retrieves detailed metadata about files and directories in a specified remote path. The tool should extract structured information about each item including its type, size, and timestamps.

Requirements

Create a Python module that implements a function to retrieve structured directory listings from an FTP server. The function should:

  1. Accept an FTP connection identifier and a remote directory path as inputs
  2. Return detailed metadata for each item in the directory including:
    • Item name
    • Item type (file, directory, or other)
    • Size in bytes (for files)
    • Modification timestamp
    • Any other available metadata attributes
  3. Return the data in a structured format (e.g., dictionary or list of dictionaries)
  4. Handle cases where the remote path doesn't exist or is inaccessible

Implementation

@generates

API

def get_directory_metadata(ftp_conn_id: str, remote_path: str) -> dict:
    """
    Retrieve structured metadata for all items in a remote FTP directory.

    Args:
        ftp_conn_id: The Airflow connection ID for the FTP server
        remote_path: The path to the remote directory

    Returns:
        Dictionary mapping item names to their metadata attributes
    """
    pass

Test Cases

  • Given a valid FTP connection and an existing remote directory path "/data", the function returns a dictionary containing metadata for all items in that directory @test
  • The returned metadata for a file includes at minimum: the item name, type indicator, and size @test
  • When the remote directory contains subdirectories, those subdirectories are included in the results with appropriate type indicators @test

Dependencies { .dependencies }

apache-airflow-providers-ftp { .dependency }

Provides FTP operations support for Apache Airflow including connection management and file transfer capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-apache-airflow-providers-ftp

tile.json