def import_module(args): from dependencies import dependencies_manager tables = [] for module in args.module: if not args.updateonly: definitions.get_importer(module)(verbose=args.verbose) tables += definitions.get_tables(module) deps = dependencies_manager.updates_for(tables, include=False) if not args.noupdate: sa_util.build_views_and_summaries( items=deps, verbose=args.verbose, )
def recreate_views(args): from dependencies import dependencies_manager views = definitions.defined_views() existing_views = sa_util.view_list() updates = dependencies_manager.updates_for(views) needed = [] for update in updates: if update in views: if update in existing_views: continue needed.append(update) needed.reverse() print needed sa_util.build_views_and_summaries( items=needed, dependencies=False, verbose=args.verbose, ) sa_util.swap_tables(verbose=args.verbose)
def build_views_and_summaries(items, all=False, verbose=0, force=False, dependencies=True): updates = [] if not dependencies: updates = items if items and dependencies: # FIXME would be nice to move this to top of page from dependencies import dependencies_manager updates = dependencies_manager.updates_for(items) if all: updates = definitions.get_all_definition_names() for item in updates: info = definitions.get_definition(item) try: if info.get('as_view'): time_fn(_build_view, args=[info], verbose=verbose, kw={'force': force}) else: time_fn(_build_summary, args=[info], verbose=verbose) except Exception as e: print 'failed %s' % item print str(e) continue