edann-expanse opened a new issue #9544: Add Annotation to Line Chart 
sqlalchemy.exc.CompileError
URL: https://github.com/apache/incubator-superset/issues/9544
 
 
   I am following this superset tutorial 
(https://superset.apache.org/usertutorial.html#annotations) to try to add 
annotations to the Tutorial Line Chart. I am running superset with 
`docker-compose up` on my laptop and have pulled down the latest version of 
`apache/incubator-superset` master. I've followed the instructions and have 
created described Annotation Layer and Annotation. 
   
   I have run into 2 issues so far:
   1) When you click on `Add Annotation Layer` I get the following error: 
```172.18.0.1 - - [14/Apr/2020 21:59:07] "GET 
/annotationlayermodelview/api/read HTTP/1.1" 404```.  I see this will be fixed 
with https://github.com/apache/incubator-superset/pull/9443, and have 
implemented the change locally, which works.
   2) After fixing (1), I am able to select the Annotation Layer. When I click 
apply, I get the following error:
   ```
   superset_1         | INFO:werkzeug:172.18.0.1 - - [15/Apr/2020 14:37:29] 
"GET 
/superset/annotation_json/3?form_data=%7B%22time_range%22%3A%22No+filter%22%7D 
HTTP/1.1" 500 -
   superset_1         | 172.18.0.1 - - [15/Apr/2020 14:37:48] "GET 
/annotationlayermodelview/api/read HTTP/1.1" 200 -
   superset_1         | INFO:werkzeug:172.18.0.1 - - [15/Apr/2020 14:37:48] 
"GET /annotationlayermodelview/api/read HTTP/1.1" 200 -
   superset_1         | 127.0.0.1 - - [15/Apr/2020 14:37:50] "GET /health 
HTTP/1.1" 200 -
   superset_1         | INFO:werkzeug:127.0.0.1 - - [15/Apr/2020 14:37:50] "GET 
/health HTTP/1.1" 200 -
   superset_1         | DEBUG:superset.stats_logger:[stats_logger] (incr) 
annotation_json
   superset_1         | DEBUG:parsedatetime:eval - with context - False, False
   superset_1         | ERROR:superset.views.base:Cannot compile Column object 
until its 'name' is assigned.
   superset_1         | Traceback (most recent call last):
   superset_1         |   File "/app/superset/views/base.py", line 120, in wraps
   superset_1         |     return f(self, *args, **kwargs)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/decorators.py",
 line 151, in wraps
   superset_1         |     return f(self, *args, **kwargs)
   superset_1         |   File "/app/superset/views/core.py", line 674, in 
annotation_json
   superset_1         |     payload = viz_obj.get_payload()
   superset_1         |   File "/app/superset/viz.py", line 404, in get_payload
   superset_1         |     payload = self.get_df_payload(query_obj)
   superset_1         |   File "/app/superset/viz.py", line 417, in 
get_df_payload
   superset_1         |     cache_key = self.cache_key(query_obj, **kwargs) if 
query_obj else None
   superset_1         |   File "/app/superset/viz.py", line 396, in cache_key
   superset_1         |     cache_dict["rls"] = 
security_manager.get_rls_ids(self.datasource)
   superset_1         |   File "/app/superset/security/manager.py", line 943, 
in get_rls_ids
   superset_1         |     ids = [f.id for f in self.get_rls_filters(table)]
   superset_1         |   File "/app/superset/security/manager.py", line 933, 
in get_rls_filters
   superset_1         |     return query.all()
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3246, in 
all
   superset_1         |     return list(self)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3405, in 
__iter__
   superset_1         |     return self._execute_and_instances(context)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3430, in 
_execute_and_instances
   superset_1         |     result = conn.execute(querycontext.statement, 
self._params)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 984, 
in execute
   superset_1         |     return meth(self, multiparams, params)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 293, 
in _execute_on_connection
   superset_1         |     return connection._execute_clauseelement(self, 
multiparams, params)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1094, 
in _execute_clauseelement
   superset_1         |     else None,
   superset_1         |   File "<string>", line 1, in <lambda>
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 468, 
in compile
   superset_1         |     return self._compiler(dialect, bind=bind, **kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 474, 
in _compiler
   superset_1         |     return dialect.statement_compiler(dialect, self, 
**kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 590, 
in __init__
   superset_1         |     Compiled.__init__(self, dialect, statement, 
**kwargs)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 319, 
in __init__
   superset_1         |     self.string = self.process(self.statement, 
**compile_kwargs)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 350, 
in process
   superset_1         |     return obj._compiler_dispatch(self, **kwargs)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 95, 
in _compiler_dispatch
   superset_1         |     return meth(self, **kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 2162, 
in visit_select
   superset_1         |     text, select, inner_columns, froms, byfrom, kwargs
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 2261, 
in _compose_select_body
   superset_1         |     t = select._whereclause._compiler_dispatch(self, 
**kwargs)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 95, 
in _compiler_dispatch
   superset_1         |     return meth(self, **kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 1003, 
in visit_clauselist
   superset_1         |     c._compiler_dispatch(self, **kw) for c in 
clauselist.clauses
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 1001, 
in <genexpr>
   superset_1         |     s
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 1003, 
in <genexpr>
   superset_1         |     c._compiler_dispatch(self, **kw) for c in 
clauselist.clauses
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 95, 
in _compiler_dispatch
   superset_1         |     return meth(self, **kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 1324, 
in visit_binary
   superset_1         |     return self._generate_generic_binary(binary, 
opstring, **kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 1372, 
in _generate_generic_binary
   superset_1         |     self, eager_grouping=eager_grouping, **kw
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 95, 
in _compiler_dispatch
   superset_1         |     return meth(self, **kw)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 869, 
in visit_column
   superset_1         |     name = self._fallback_column_name(column)
   superset_1         |   File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 861, 
in _fallback_column_name
   superset_1         |     "Cannot compile Column object until " "its 'name' 
is assigned."
   superset_1         | sqlalchemy.exc.CompileError: Cannot compile Column 
object until its 'name' is assigned.
   ```
   This is what the UI looks like:
   ![Screen Shot 2020-04-15 at 10 55 05 
AM](https://user-images.githubusercontent.com/62569463/79352253-96d10200-7f07-11ea-98be-c3b14b1f2787.png)
   
   
   #### How to reproduce the bug
   
   You can reproduce the bug by following the instructions here: 
https://superset.apache.org/usertutorial.html#annotations
   
   ### Environment
   running `docker-compose up` on the latest version of master
   
   ### Checklist
   
   Make sure these boxes are checked before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version 
of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to