CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
json_test.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 
4 Example script to show returning data as json.
5 
6 """
7 
8 import sys
9 from CondCore.Utilities.CondDBFW import querying_framework_api
10 
11 class query_script():
12  def script(self, connection):
13  tags = connection.tag().all(amount=sys.argv[1])
14  return tags
15 
16 connection_data = {"db_alias" : "orapro", "schema" : "cms_conditions", "host" : "oracle", "secrets" : "/afs/cern.ch/cms/DB/conddb/.cms_cond/netrc"}
17 qf = querying_framework_api(connection_data)
18 data = qf.run_script(query_script()).as_dicts()
19 
20 import pprint
21 pprint.pprint(data)