Chris Harris
Chris Harris

Reputation: 402

How do I install Apache Superset CLI on Windows?

Superset offers a CLI for managing the Superset instance, but I am unable to find instructions for getting it installed and talking to my instance of Superset.

My local machine is Windows, but my instance of Superset is running in a hosted Kubernetes cluster.

-- Update 2 2022.08.06

After some continued exploration, have found some steps that seem to be getting me closer.

# clone the Superset repo
git clone https://github.com/apache/superset
cd superset

# create a virtual environment using Python 3.9, 
# which is compatible with the current version of numpy
py -3.9 -m venv .venv
.venv\Scripts\activate

# install the Superset package
pip install apache-superset

# install requirements (not 100% sure which requirements are needed)
pip install -r .\requirements\base.txt
pip install -r .\requirements\development.txt

# install psycopg2
pip install psycopg2

# run superset-cli
superset-cli
# error: The term 'superset-cli' is not recognized

# run superset
superset

superset will run, but now I'm getting an error from psycopg2 about unknown host:

Loaded your LOCAL configuration at [c:\git\superset\superset_config.py]
logging was configured successfully
2022-08-06 06:29:08,311:INFO:superset.utils.logging_configurator:logging was configured successfully
2022-08-06 06:29:08,317:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-08-06 06:29:08,318:WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `EXPLORE_FORM_DATA_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-08-06 06:29:08,322:WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `EXPLORE_FORM_DATA_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-08-06 06:29:10,602:ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (psycopg2.OperationalError) could not translate host name "None" to address: Unknown host

My config file c:\git\superset\superset_config.py has the following database settings:

DATABASE_HOST     = os.getenv("DATABASE_HOST")
DATABASE_DB       = os.getenv("DATABASE_DB")
POSTGRES_USER     = os.getenv("POSTGRES_USER")
POSTGRES_PASSWORD = os.getenv("DATABASE_PASSWORD")

I could set those values in the superset_config.py or I could set the environment variables and let superset_config.py read them. However, my instance of superset is running in a hosted kubernetes cluster and the superset-postgres service is not exposed by external ip. The only service with an external ip is superset.

Still stuck...

Upvotes: 0

Views: 1341

Answers (1)

Chris Harris
Chris Harris

Reputation: 402

I was way off track - once I found the Preset-io backend-sdk repo on github it started coming together. https://github.com/preset-io/backend-sdk

Install superset-cli

mkdir superset_cli
cd superset_cli
py -3.9 -m venv .venv
.venv\Scripts\activate

pip install -U setuptools setuptools_scm wheel  #for good measure 
pip install "git+https://github.com/preset-io/backend-sdk.git"

Example command

# Export resources (databases, datasets, charts, dashboards) 
#     into a directory as YAML files from a superset site: https://superset.example.org

mkdir export
superset-cli -u [username] -p [password] https://superset.example.org export export

Upvotes: 0

Related Questions