Comments (6)
The superset fab list-users
command does not include the firstname
, lastname
, and active
columns in its output because these columns are not specified in the list_columns
attribute of the UserModelView
class. The list_columns
attribute determines which columns are displayed when listing users.
To include the firstname
, lastname
, and active
columns in the output, you need to modify the UserModelView
class to specify these columns in the list_columns
attribute. Here is an example of how you can do this:
from flask_appbuilder import ModelView
from flask_appbuilder.security.sqla.models import User
class CustomUserModelView(ModelView):
datamodel = SQLAInterface(User)
list_columns = ["id", "username", "firstname", "lastname", "active", "email"]
appbuilder.add_view(
CustomUserModelView,
"List Users",
icon="fa-user",
label=_("List Users"),
category="Security",
category_icon="fa-cogs",
)
By adding the firstname
, lastname
, and active
columns to the list_columns
attribute, they will be included in the output of the superset fab list-users
command [1].
Details
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
The superset fab list-users
command is implemented in the superset/cli/fab.py
file. The entry point for the CLI is the superset
function in the superset/cli/main.py
file, which dynamically adds sub-commands from the superset.cli
package, including the list-users
command.
Here is a snippet showing how sub-commands are added:
# superset/cli/main.py
@click.group(
cls=FlaskGroup,
context_settings={"token_normalize_func": normalize_token},
)
@with_appcontext
def superset() -> None:
"""\033[1;37mThe Apache Superset CLI\033[0m"""
@app.shell_context_processor
def make_shell_context() -> dict[str, Any]:
return {"app": app, "db": db}
# add sub-commands
for load, module_name, is_pkg in pkgutil.walk_packages(
cli.__path__, cli.__name__ + "."
):
module = importlib.import_module(module_name)
for attribute in module.__dict__.values():
if isinstance(attribute, (click.core.Command, click.core.Group)):
superset.add_command(attribute)
if isinstance(attribute, click.core.Group):
break
This setup allows the superset
CLI to include various sub-commands defined in the superset.cli
package [1].
Details
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
It appears there might be some confusion or outdated information regarding the file structure. The list-users
command and its related functionalities might be located in a different file or have been refactored.
To locate the exact implementation of the list-users
command, you can search for the command definition within the superset/cli
directory. Look for files that define CLI commands using the click
library, as this is commonly used for command-line interfaces in Python.
If you need to modify the output of the list-users
command to include firstname
, lastname
, and active
columns, you can refer to the UserResponseSchema
class in the superset/views/users/schemas.py
file, which already includes these fields:
class UserResponseSchema(Schema):
id = Integer()
username = String()
email = String()
first_name = String()
last_name = String()
is_active = Boolean()
is_anonymous = Boolean()
Additionally, the bootstrap_user_data
function in the superset/views/utils.py
file can be used to fetch these details:
def bootstrap_user_data(user: User, include_perms: bool = False) -> dict[str, Any]:
payload = {
"username": user.username,
"firstName": user.first_name,
"lastName": user.last_name,
"isActive": user.is_active,
"isAnonymous": user.is_anonymous,
}
return payload
These utilities can help you extend the list-users
command to include the desired columns [1][2].
Details
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
@dosu where the superset fab list-users command is defined ?
from superset.
@dosu I find superset/cli/main.py file but not superset/cli/fab.py file
from superset.
@dpgaspar might know if this is a bug or intentional by design for some reason.
from superset.
Related Issues (20)
- Changing the language takes you to the list of users HOT 2
- A gamma does not see dataset (even if is public) HOT 1
- [DRAFT][SIP-142] Improving Database Migration Management
- Docker Compose Up does not work HOT 13
- Annotation Layers at Horizontal Barchart HOT 3
- celeryconfig.py HOT 2
- [ParsedQuery] Check is_read_only_query too slow HOT 1
- How to make gradient color for metric puted as bar in mixed chart in Superset 4.0.0. HOT 2
- [Dev build] Stacked chart tooltip highlights a different series than the one I'm hovering over HOT 4
- Schema name and Table name are empty after CSV import HOT 1
- [SIP] Ability to connect with a second user to run db migrations only HOT 2
- Extend API to handle uuid HOT 1
- Getting superset error: 'str' object has no attribute 'tzinfo' when using elasticsearch with superset:// HOT 4
- Error 'DISALLOWED_SQL_FUNCTION' in new superset update 4.0.2 HOT 4
- Superset is not starting because of secret key issue. HOT 4
- [SIP] Ability to connect to postgres with different schema with superset_config HOT 9
- Compose file './docker-compose.yml' invalid HOT 6
- Custom chart plugins not working in Kubernetes deployment HOT 2
- Remove or make less prominent legacy contributing guide HOT 3
- Request for neo4j driver HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.