# GoodData FlexFun
The GoodData FlexFun package is a GoodData Flight Server-compatible extension
that provides a framework for hosting custom pluggable functions called FlexFuns.
These can be used to act as a dataset for GoodData FlightRPC data sources.
## What is a FlexFun?
In essence, FlexFun is a class that provides a set of methods that can be called by the GoodData Cloud when data is
requested from the corresponding FlightRPC data source dataset.
Each FlexFun provides a `name` used to identify the FlexFun in the GoodData Cloud.
FlexFuns can provide a set of `metadata` that can further influence when and how they are called by GoodData Cloud.
They also provide a `schema` (defined in terms
of [pyarrow.Schema](https://arrow.apache.org/docs/python/generated/pyarrow.Schema.html))
that describes the shape of data that the FlexFun can provide.
Finally, they provide a set of methods that can be called to provide data in response to queries:
* `call` - called to provide data in response to a query
* `cancel` - called to cancel a query if GoodData Cloud decides to stop requesting data (e.g. if there is a timeout)
* `on_load` - called when the FlexFun is created before any `call` or `cancel` methods are called
## Getting Started using the FlexFun Template
The easiest way to get started writing FlexFuns is to use [the template repository](https://github.com/gooddata/gooddata-flexfun-template).
It provides a simple example of a FlexFun that can be used as a starting point for your own FlexFun with all the necessary infrastructure in place.
It also has a README that explains how to get started with the template and some general tips on how to write FlexFuns.
## Getting started using the FlexFun package directly
Install the package alongside the gooddata-flight-server using pip:
```bash
pip install gooddata-flight-server gooddata-flexfun
```
Next, update the GoodData Flight Server configuration to load the FlexFun methods.
```toml
[flexfun]
# specify one or more modules that contain your FlexFun implementations
#
functions = [
"flexfun.your_function"
]
```
Then when running the GoodData Flight Server, use the `--methods-provider` option to load the FlexFun methods.
For example:
```bash
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SERVER_CMD="${SCRIPT_DIR}/.venv/bin/gooddata-flight-server"
export PYTHONPATH="${SCRIPT_DIR}/src"
export CONFIG_ENV="${1:-dev}"
$SERVER_CMD start \
--methods-provider gooddata_flexfun \
--config \
config/${CONFIG_ENV}.server.toml \
config/flexfun.config.toml \
--logging-config config/default.logging.ini \
--dev-log
```
This will start the GoodData Flight Server with the FlexFun methods loaded.
Raw data
{
"_id": null,
"home_page": null,
"name": "gooddata-flexfun",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9.0",
"maintainer_email": null,
"keywords": "gooddata, flight, rpc, flight rpc, custom functions, analytics, headless, business, intelligence, headless-bi, cloud, native, semantic, layer, sql, metrics",
"author": "GoodData",
"author_email": "support@gooddata.com",
"download_url": "https://files.pythonhosted.org/packages/19/22/c49be251099dda029e7784a06dbe0553b706a3412d004fed85f9e2ea03be/gooddata_flexfun-1.30.0.tar.gz",
"platform": null,
"description": "# GoodData FlexFun\n\nThe GoodData FlexFun package is a GoodData Flight Server-compatible extension\nthat provides a framework for hosting custom pluggable functions called FlexFuns.\nThese can be used to act as a dataset for GoodData FlightRPC data sources.\n\n## What is a FlexFun?\n\nIn essence, FlexFun is a class that provides a set of methods that can be called by the GoodData Cloud when data is\nrequested from the corresponding FlightRPC data source dataset.\n\nEach FlexFun provides a `name` used to identify the FlexFun in the GoodData Cloud.\nFlexFuns can provide a set of `metadata` that can further influence when and how they are called by GoodData Cloud.\nThey also provide a `schema` (defined in terms\nof [pyarrow.Schema](https://arrow.apache.org/docs/python/generated/pyarrow.Schema.html))\nthat describes the shape of data that the FlexFun can provide.\nFinally, they provide a set of methods that can be called to provide data in response to queries:\n* `call` - called to provide data in response to a query\n* `cancel` - called to cancel a query if GoodData Cloud decides to stop requesting data (e.g. if there is a timeout)\n* `on_load` - called when the FlexFun is created before any `call` or `cancel` methods are called\n\n## Getting Started using the FlexFun Template\n\nThe easiest way to get started writing FlexFuns is to use [the template repository](https://github.com/gooddata/gooddata-flexfun-template).\nIt provides a simple example of a FlexFun that can be used as a starting point for your own FlexFun with all the necessary infrastructure in place.\nIt also has a README that explains how to get started with the template and some general tips on how to write FlexFuns.\n\n## Getting started using the FlexFun package directly\n\nInstall the package alongside the gooddata-flight-server using pip:\n\n```bash\npip install gooddata-flight-server gooddata-flexfun\n```\n\nNext, update the GoodData Flight Server configuration to load the FlexFun methods.\n\n```toml\n[flexfun]\n\n# specify one or more modules that contain your FlexFun implementations\n#\nfunctions = [\n \"flexfun.your_function\"\n]\n```\n\nThen when running the GoodData Flight Server, use the `--methods-provider` option to load the FlexFun methods.\nFor example:\n\n```bash\n#!/bin/bash\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" &> /dev/null && pwd )\"\nSERVER_CMD=\"${SCRIPT_DIR}/.venv/bin/gooddata-flight-server\"\n\nexport PYTHONPATH=\"${SCRIPT_DIR}/src\"\nexport CONFIG_ENV=\"${1:-dev}\"\n\n$SERVER_CMD start \\\n --methods-provider gooddata_flexfun \\\n --config \\\n config/${CONFIG_ENV}.server.toml \\\n config/flexfun.config.toml \\\n --logging-config config/default.logging.ini \\\n --dev-log\n```\n\nThis will start the GoodData Flight Server with the FlexFun methods loaded.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Set of gooddata-flight-server methods to host custom functions for GoodData Cloud",
"version": "1.30.0",
"project_urls": {
"Documentation": "https://gooddata-flexfun.readthedocs.io/en/v1.30.0",
"Source": "https://github.com/gooddata/gooddata-python-sdk"
},
"split_keywords": [
"gooddata",
" flight",
" rpc",
" flight rpc",
" custom functions",
" analytics",
" headless",
" business",
" intelligence",
" headless-bi",
" cloud",
" native",
" semantic",
" layer",
" sql",
" metrics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6b4ba5e5be270a924006f29fbe7b600df303b43f3d086a0a559be9f227d4532a",
"md5": "5f376f337d3b3f9eb069bb8fedc37cc0",
"sha256": "e38e7d7e481acb09308540ddb853eacb19b71241d677a969f2fb8e3e3710a86e"
},
"downloads": -1,
"filename": "gooddata_flexfun-1.30.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5f376f337d3b3f9eb069bb8fedc37cc0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9.0",
"size": 47571,
"upload_time": "2024-10-31T15:35:47",
"upload_time_iso_8601": "2024-10-31T15:35:47.247859Z",
"url": "https://files.pythonhosted.org/packages/6b/4b/a5e5be270a924006f29fbe7b600df303b43f3d086a0a559be9f227d4532a/gooddata_flexfun-1.30.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1922c49be251099dda029e7784a06dbe0553b706a3412d004fed85f9e2ea03be",
"md5": "0f3d82c9859f3e0bd912db7cf8e0b316",
"sha256": "8f7655590d65cc453ea911ffebdd49552f47e7821fc610cedc70480d09ebf156"
},
"downloads": -1,
"filename": "gooddata_flexfun-1.30.0.tar.gz",
"has_sig": false,
"md5_digest": "0f3d82c9859f3e0bd912db7cf8e0b316",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9.0",
"size": 46586,
"upload_time": "2024-10-31T15:35:56",
"upload_time_iso_8601": "2024-10-31T15:35:56.501552Z",
"url": "https://files.pythonhosted.org/packages/19/22/c49be251099dda029e7784a06dbe0553b706a3412d004fed85f9e2ea03be/gooddata_flexfun-1.30.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 15:35:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gooddata",
"github_project": "gooddata-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gooddata-flexfun"
}