create_resource_properties_script

create_resource_properties_script(
    resource_name: str | None = None,
    fields: list[FieldProperties] | None = None,
    path: Path | None = None,
)

Create a script using the resource properties template.

You can include the resource name and the fields’ name and type information. If the script already exists, it will not be overwritten.

Parameters

resource_name : str | None = None

The name of the new resource. Defaults to None.

fields : list[FieldProperties] | None = None

The fields (columns) of the new resource. Defaults to None.

path : Path | None = None

The path to the package folder. Defaults to the current working directory.

Returns

Path

The path to the newly created script file.

Raises

ValueError

If the resource name is not correct (e.g., contains spaces).

Examples

import seedcase_sprout as sp

with sp.ExamplePackage():
    sp.create_resource_properties_script("my-resource")
PosixPath('/tmp/tmp7aylm4pp/example-package/scripts/resource_properties_my_resource.py')