@@ -19,6 +19,8 @@ def __init__(self, model, where=query.WhereNode, alias_cols=True):
19
19
super ().__init__ (model , where , alias_cols )
20
20
self .setting_info = {}
21
21
self .prewhere = query .WhereNode ()
22
+ self .sample_fraction = None
23
+ self .sample_offset = None
22
24
23
25
def sql_with_params (self ):
24
26
"""Choose the right db when database router is used."""
@@ -28,6 +30,8 @@ def clone(self):
28
30
obj = super ().clone ()
29
31
obj .setting_info = self .setting_info .copy ()
30
32
obj .prewhere = self .prewhere .clone ()
33
+ obj .sample_fraction = self .sample_fraction
34
+ obj .sample_offset = self .sample_offset
31
35
return obj
32
36
33
37
def explain (self , using , format = None , type = None , ** settings ):
@@ -36,6 +40,10 @@ def explain(self, using, format=None, type=None, **settings):
36
40
compiler = q .get_compiler (using = using )
37
41
return "\n " .join (compiler .explain_query ())
38
42
43
+ def add_sample (self , sample_fraction , sample_offset ):
44
+ self .sample_fraction = sample_fraction
45
+ self .sample_offset = sample_offset
46
+
39
47
def add_prewhere (self , q_object ):
40
48
"""
41
49
refer add_q
0 commit comments