input(path)

Carrega o arquivo inicial para load e carga na bronze.

Parameters:
  • path (str) –

    diretorio origem

Returns:
  • DataFrame

    Um dataframe com metadados do arquivo consumido.

Raises:
  • ValueError

    Caso path esteja vazio.

Examples:

>>> input('path/origem/account.csv')
DataFrame[age: bigint, name: string]
Source code in dtmaster_ingest_douglasleal/input.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def input(path: str) -> DataFrame:
    """
    Carrega o arquivo inicial para load e carga na bronze.

    Args:
        path: diretorio origem

    Returns:
        Um dataframe com metadados do arquivo consumido.

    Raises:
        ValueError: Caso path esteja vazio.

    Examples:
        >>> input('path/origem/account.csv')
        DataFrame[age: bigint, name: string]
    """

    if path == '':
        raise ValueError(f'path is required')

    spark = SparkSession.builder.appName(
        'Testing PySpark Example'
    ).getOrCreate()
    sample_data = [
        {'name': 'John    D.', 'age': 30},
        {'name': 'Alice   G.', 'age': 25},
    ]

    df = spark.createDataFrame(sample_data)

    return df