create_resource_properties_script

Warning

🚧 Sprout is still in active development and evolving quickly, so the documentation and functionality may not work as described and could undergo substantial changes 🚧

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/tmp7xv5f8e7/example-package/scripts/resource_properties_my_resource.py')