[GitHub] mistercrunch commented on a change in pull request #3509: Add Table performance improvements

2017-09-22 Thread git
mistercrunch commented on a change in pull request #3509: Add Table performance 
improvements
URL: 
https://github.com/apache/incubator-superset/pull/3509#discussion_r140542853
 
 

 ##
 File path: superset/models/core.py
 ##
 @@ -743,6 +744,16 @@ def get_perm(self):
 return (
 "[{obj.database_name}].(id:{obj.id})").format(obj=self)
 
+def has_table(self, table):
+engine = self.get_sqla_engine()
+return engine.dialect.has_table(
+engine, table.table_name, table.schema or None)
+
+def get_dialect(self):
+sqla_url = url.make_url(self.sqlalchemy_uri_decrypted)
+entrypoint = sqla_url._get_entrypoint()
 
 Review comment:
   also for the sake of moving forward I don't mind if you just call 
`get_sqla_engine` here and save the `sqla_engine` memoized property for another 
PR
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mistercrunch commented on a change in pull request #3509: Add Table performance improvements

2017-09-22 Thread git
mistercrunch commented on a change in pull request #3509: Add Table performance 
improvements
URL: 
https://github.com/apache/incubator-superset/pull/3509#discussion_r140542551
 
 

 ##
 File path: superset/models/core.py
 ##
 @@ -743,6 +744,16 @@ def get_perm(self):
 return (
 "[{obj.database_name}].(id:{obj.id})").format(obj=self)
 
+def has_table(self, table):
+engine = self.get_sqla_engine()
+return engine.dialect.has_table(
+engine, table.table_name, table.schema or None)
+
+def get_dialect(self):
+sqla_url = url.make_url(self.sqlalchemy_uri_decrypted)
+entrypoint = sqla_url._get_entrypoint()
 
 Review comment:
   check out the `@memoize` decorator in `superset.utils`
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mistercrunch commented on a change in pull request #3509: Add Table performance improvements

2017-09-22 Thread git
mistercrunch commented on a change in pull request #3509: Add Table performance 
improvements
URL: 
https://github.com/apache/incubator-superset/pull/3509#discussion_r140542113
 
 

 ##
 File path: superset/models/core.py
 ##
 @@ -743,6 +744,16 @@ def get_perm(self):
 return (
 "[{obj.database_name}].(id:{obj.id})").format(obj=self)
 
+def has_table(self, table):
+engine = self.get_sqla_engine()
+return engine.dialect.has_table(
+engine, table.table_name, table.schema or None)
+
+def get_dialect(self):
+sqla_url = url.make_url(self.sqlalchemy_uri_decrypted)
+entrypoint = sqla_url._get_entrypoint()
 
 Review comment:
   I hate calling private functions in external libs though... there's no 
guarantees as to whether the api may change in minor version changes.
   
   To mitigate the cost we could change the use of `get_sqla_engine` by using a 
cached `engine` `@property`. I think it's only a matter of adding a decorator.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mistercrunch commented on a change in pull request #3509: Add Table performance improvements

2017-09-20 Thread git
mistercrunch commented on a change in pull request #3509: Add Table performance 
improvements
URL: 
https://github.com/apache/incubator-superset/pull/3509#discussion_r140152528
 
 

 ##
 File path: superset/models/core.py
 ##
 @@ -743,6 +744,16 @@ def get_perm(self):
 return (
 "[{obj.database_name}].(id:{obj.id})").format(obj=self)
 
+def has_table(self, table):
+engine = self.get_sqla_engine()
+return engine.dialect.has_table(
+engine, table.table_name, table.schema or None)
+
+def get_dialect(self):
+sqla_url = url.make_url(self.sqlalchemy_uri_decrypted)
+entrypoint = sqla_url._get_entrypoint()
 
 Review comment:
   why not `return self.get_sqla_engine().dialect` ?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services