How to use memoize_get_rendered method in dbt-osmosis

Best Python code snippet using dbt-osmosis_python

osmosis.py

Source:osmosis.py Github

copy

Full Screen

...80T = TypeVar("T")81def has_jinja(query: str) -> bool:82 """Utility to check for jinja prior to certain compilation procedures"""83 return any(seq in query for seq in JINJA_CONTROL_SEQS)84def memoize_get_rendered(function):85 """Custom memoization function for dbt-core jinja interface"""86 def wrapper(87 string: str,88 ctx: Dict[str, Any],89 node: ManifestNode = None,90 capture_macros: bool = False,91 native: bool = False,92 ):93 v = md5(string.strip().encode("utf-8")).hexdigest()94 v += "__" + str(CACHE_VERSION)95 if capture_macros == True and node is not None:96 if node.is_ephemeral:97 return function(string, ctx, node, capture_macros, native)98 v += "__" + node.unique_id99 rv = CACHE.get(v)100 if rv is not None:101 return rv102 else:103 rv = function(string, ctx, node, capture_macros, native)104 CACHE[v] = rv105 return rv106 return wrapper107# Performance hacks108# jinja.get_rendered = memoize_get_rendered(jinja.get_rendered)109disable_tracking()110fire_event = lambda e: None111class ConfigInterface:112 """This mimic dbt-core args based interface for dbt-core113 class instantiation"""114 def __init__(115 self,116 threads: Optional[int] = 1,117 target: Optional[str] = None,118 profiles_dir: Optional[str] = None,119 project_dir: Optional[str] = None,120 vars: Optional[str] = "{}",121 ):122 self.threads = threads...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run dbt-osmosis automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful