File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 22
22
from wren_core import SessionContext
23
23
from app .model .data_source import BigQueryConnectionInfo
24
24
from app .model .data_source import DataSourceExtension
25
+ import wren_core
25
26
26
27
if sys .stdin .isatty ():
27
28
print ("please provide the SQL query via stdin, e.g. `python query_local_run.py < test.sql`" , file = sys .stderr )
57
58
with open (connection_info_path ) as file :
58
59
connection_info = json .load (file )
59
60
61
+ # Extract the requried tables from the SQL query
62
+ extractor = wren_core .ManifestExtractor (encoded_str )
63
+ tables = extractor .resolve_used_table_names (sql )
64
+ print ("# Tables used in the SQL query:" , tables )
65
+ # Extract the manifest for the required tables
66
+ manifest = extractor .extract_by (tables )
67
+ encoded_str = wren_core .to_json_base64 (manifest )
68
+
60
69
print ("### Starting the session context ###" )
61
70
print ("#" )
62
71
session_context = SessionContext (encoded_str , function_list_path + f"/{ data_source } .csv" )
You can’t perform that action at this time.
0 commit comments