From 5be7637f0d7c55e993401fe13c996af472733b73 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Sat, 28 Sep 2024 23:28:56 -0700 Subject: [PATCH] support search w/o options and make it faster.. --- ui/medashare/cli.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ui/medashare/cli.py b/ui/medashare/cli.py index 656a28f..54c628b 100644 --- a/ui/medashare/cli.py +++ b/ui/medashare/cli.py @@ -1594,6 +1594,31 @@ def cmd_search(options, persona, objstr, cache): searches = [ (x[0], ) + tuple(x[1:].split('=', 1)) for x in args ] #_debprint(repr(searches)) + if not searches: + # just dump everything + mdofile = aliased(orm.MetaDataObject) + + sel = select(mdofile.data).where( + # we are operating on files + mdofile.type == 'file') + + sel = sel.execution_options(yield_per=10) + + with objstr._ses() as session: + r = ( x[0] for x in session.execute(sel) ) + + if _type == 'file': + mapping = FileObject.prep_mapping( + objstr.get_hostmappings()) + r = ( x.get_lcl_name(mapping) for x in r ) + else: + raise ValueError('unhandled type: %s' % repr(_type)) + + for i in r: + print(i) + + return + propmap = aliased(orm.PropertyMapping) # propobj only returns what can match query