Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activating new user results with InvalidRequestError: SQL expression, column, or mapped entity expected - got 'None' #392

Closed
mnrozhkov opened this issue Apr 22, 2016 · 2 comments
Labels
!deprecated-label:bug Deprecated label - Use #bug instead

Comments

@mnrozhkov
Copy link

System details: MacOSX/10.11.4, SQLite, run under development mode
Go to Security/List users menu.
Create user and try to activate him:
image

Selecting checkbox "Is Active?" for new user results with _InvalidRequestError: SQL expression, column, or mapped entity expected - got 'None' _

The request "GET /caravel/checkbox/UserDBModelView/2/active/false HTTP/1.1" results with status 500 (Full traceback is here: https://gist.github.com/mnrozhkov/35c702c892fcbeb9b2683d042dc6c48f )

This url is exposed in view.caravel.checkbox method
(code sample is here: https://gist.github.com/mnrozhkov/d2a597eed823b6e2df810b505206ebcf)

The UserDBModelView is note recognized by view.caravel.checkbox method. This leads to model = 'None' . So, have you encountered this issue? Any suggestions to solve this?

@mistercrunch mistercrunch added the !deprecated-label:bug Deprecated label - Use #bug instead label Apr 23, 2016
@mnrozhkov
Copy link
Author

It seems I could solve this...

First, create security module 'mysec.py' to store custom MyUser model, MyUserDBModelView and MySecurityManager. For experimenting purpose I've add a column field named 'app_access'
See here: https://gist.github.com/mnrozhkov/3658bbea6b8f6cf93d5fafb0713c0aba

Second, update view.caravel.checkbox method:
Add two strings:

        elif model_view == 'MyUserDBModelView':
            model = mysec.MyUser

See here: https://gist.github.com/mnrozhkov/781b7d78972e37f9b53d71747805d836

Third, update config.py
from caravel.mysec import MySecurityManager
...
CUSTOM_SECURITY_MANAGER = MySecurityManager

Last, migrate DB using Alembic and that's it!

@mistercrunch
Copy link
Member

Notice: this issue has been closed because it has been inactive for 727 days. Feel free to comment and request for this issue to be reopened.

zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
* fix(legacy-table): avoid React DOM

`jquery.datatables` will manipulate DOMs, sometimes remove them. In case
of component being reloaded with updated props, React will not be able
to find those removed nodes, causing a `cannot removeChild` error.

Because of the the way to assign row keys, if table shape changes (add
or remove columns), React may also have difficulty match the cached
nodes via keys.

In general it's a bad idea to directly manipulate React rendered DOM
nodes, so we better just let `jquery.datatables` handle everything.

In the future, once we removed `jquery.datatables`, a pure React
component will not have such issues.

* fix(legacy-table): handle the case when percentMetrics is null

* fix(legacy-table): linting errors

* refactor: use nimbus build

* test(legacy-table): add React component tests

* test(legacy-table): more sophisticated cases

* fix: address PR apache#392 comments

* chore(legacy-table): clean up tests case setups

Not seeing the console.warn errors anymore. So cleaning it up.

Previously it was from `<SuperChart />` component, but since we have
updated the test case to not use <SuperChart>, we are good now.

* fix(legacy-table): misleading comment
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
Bumps [d3-color](https://github.com/d3/d3-color) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](d3/d3-color@v1.4.0...v1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
* fix(legacy-table): avoid React DOM

`jquery.datatables` will manipulate DOMs, sometimes remove them. In case
of component being reloaded with updated props, React will not be able
to find those removed nodes, causing a `cannot removeChild` error.

Because of the the way to assign row keys, if table shape changes (add
or remove columns), React may also have difficulty match the cached
nodes via keys.

In general it's a bad idea to directly manipulate React rendered DOM
nodes, so we better just let `jquery.datatables` handle everything.

In the future, once we removed `jquery.datatables`, a pure React
component will not have such issues.

* fix(legacy-table): handle the case when percentMetrics is null

* fix(legacy-table): linting errors

* refactor: use nimbus build

* test(legacy-table): add React component tests

* test(legacy-table): more sophisticated cases

* fix: address PR apache#392 comments

* chore(legacy-table): clean up tests case setups

Not seeing the console.warn errors anymore. So cleaning it up.

Previously it was from `<SuperChart />` component, but since we have
updated the test case to not use <SuperChart>, we are good now.

* fix(legacy-table): misleading comment
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
Bumps [d3-color](https://github.com/d3/d3-color) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](d3/d3-color@v1.4.0...v1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
* fix(legacy-table): avoid React DOM

`jquery.datatables` will manipulate DOMs, sometimes remove them. In case
of component being reloaded with updated props, React will not be able
to find those removed nodes, causing a `cannot removeChild` error.

Because of the the way to assign row keys, if table shape changes (add
or remove columns), React may also have difficulty match the cached
nodes via keys.

In general it's a bad idea to directly manipulate React rendered DOM
nodes, so we better just let `jquery.datatables` handle everything.

In the future, once we removed `jquery.datatables`, a pure React
component will not have such issues.

* fix(legacy-table): handle the case when percentMetrics is null

* fix(legacy-table): linting errors

* refactor: use nimbus build

* test(legacy-table): add React component tests

* test(legacy-table): more sophisticated cases

* fix: address PR apache#392 comments

* chore(legacy-table): clean up tests case setups

Not seeing the console.warn errors anymore. So cleaning it up.

Previously it was from `<SuperChart />` component, but since we have
updated the test case to not use <SuperChart>, we are good now.

* fix(legacy-table): misleading comment
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
Bumps [d3-color](https://github.com/d3/d3-color) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](d3/d3-color@v1.4.0...v1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
* fix(legacy-table): avoid React DOM

`jquery.datatables` will manipulate DOMs, sometimes remove them. In case
of component being reloaded with updated props, React will not be able
to find those removed nodes, causing a `cannot removeChild` error.

Because of the the way to assign row keys, if table shape changes (add
or remove columns), React may also have difficulty match the cached
nodes via keys.

In general it's a bad idea to directly manipulate React rendered DOM
nodes, so we better just let `jquery.datatables` handle everything.

In the future, once we removed `jquery.datatables`, a pure React
component will not have such issues.

* fix(legacy-table): handle the case when percentMetrics is null

* fix(legacy-table): linting errors

* refactor: use nimbus build

* test(legacy-table): add React component tests

* test(legacy-table): more sophisticated cases

* fix: address PR apache#392 comments

* chore(legacy-table): clean up tests case setups

Not seeing the console.warn errors anymore. So cleaning it up.

Previously it was from `<SuperChart />` component, but since we have
updated the test case to not use <SuperChart>, we are good now.

* fix(legacy-table): misleading comment
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
Bumps [d3-color](https://github.com/d3/d3-color) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](d3/d3-color@v1.4.0...v1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead
Projects
None yet
Development

No branches or pull requests

2 participants