Skip to main content

index

Objects

BaseInput

class BaseInput(BaseModel)

Base input event as a dataclass.

Arguments:

  • BaseModel BaseModel - inherited from pydantic.

Attributes:

  • workspace str - name of the workspace.
  • layername str - name of the layer.
  • date str, optional - date in %YYYYmmDD format.
  • bucket str, optional - source bucket name, defaults to a target bucket.
  • prefix str, optional - output prefix to store files.
  • output str, optional - output filename, entire object path is a concatenation of prefix/output
  • job_id str, optional - input job ID to search paths and dates
  • order_id int, optional - input order ID to search paths and dates

Functions

pull_geometries

def pull_geometries(workspace: str,
layername: str,
date: str | None = "") -> List[dict]

Function to extract geometries and attributes from RDS

Arguments:

  • workspace str - name of the workspace.
  • layername str - name of the layer.
  • date str, optional - date in YYYYmmDD or YYYY-mm-DD format. Defaults to "".

Returns:

  • list of dict - an array of records

Examples:

pull_geometries(
workspace="some-workspace",
layername="some-layer",
date="2021-02-01"
)

schema_constructor

def schema_constructor(workspace: str, layername: str) -> dict

Function to build a Fiona schema to export data.

Arguments:

  • workspace str - name of the workspace.
  • layername str - name of the layer.

Returns:

  • dict - a constructed fiona schema

Examples:

schema_constructor(
workspace="some-workspace",
layername="some-layer"
)

lambda_handler

@tracer.capture_lambda_handler
@logger.inject_lambda_context()
def lambda_handler(event: dict, context: dict) -> dict

Function to export geometries from a database table like RDS (AuroraDB).

Arguments:

  • event dict - input event, must be convertable to BaseInput.
  • context dict - contains authentication information.

Returns:

  • dict - output event

Examples:

{
"workspace": "some-workspace",
"layername": "some-layer",
"date": "20210201",
"bucket": "some-bucket",
"prefix": "some/path/to/the/output",
"output": "output.shp",
"job_id": "12354646-jobid-234143fwwr4cw43",
"order_id": 1337
}