diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2016-06-15 15:17:10 -0400 |
---|---|---|
committer | Gerrit Code Review <gerrit2@ln3.zzzcomputing.com> | 2016-06-15 15:17:10 -0400 |
commit | 5c80400ec7c5631d251bac43342637637b9c8214 (patch) | |
tree | bc12c870a429a6ebd9d4882cbf2e24bf4d3302bf /lib/sqlalchemy/sql/compiler.py | |
parent | ecca1f814e6af9c84e24ee05929f5a8455846f40 (diff) | |
parent | 20f2f5b169d35cfee7cc21ff697e23fd00858171 (diff) | |
download | sqlalchemy-5c80400ec7c5631d251bac43342637637b9c8214.tar.gz |
Merge "Add TABLESAMPLE clause support."
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 94c7db20a..5e537dfdc 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1351,6 +1351,17 @@ class SQLCompiler(Compiled): kw['lateral'] = True return "LATERAL %s" % self.visit_alias(lateral, **kw) + def visit_tablesample(self, tablesample, asfrom=False, **kw): + text = "%s TABLESAMPLE %s" % ( + self.visit_alias(tablesample, asfrom=True, **kw), + tablesample._get_method()._compiler_dispatch(self, **kw)) + + if tablesample.seed is not None: + text += " REPEATABLE (%s)" % ( + tablesample.seed._compiler_dispatch(self, **kw)) + + return text + def get_render_as_alias_suffix(self, alias_name_text): return " AS " + alias_name_text |