diff options
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 3d2f02006..ab1b42b2f 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1324,6 +1324,18 @@ 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(%s)" % ( + self.visit_alias(tablesample, asfrom=True, **kw), + tablesample.method, + tablesample.arg) + + 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 |