Home | Trees | Indices | Help |
|
---|
|
1 """ 2 Handling table metadata in the dc.(table|column)meta tables. 3 4 This has been a mediocre plan, and it's almost unused these days except 5 to locate RDs for tables. Hence, we should tear this entire thing down 6 and have the table->RD mapping stowed somewhere else. 7 8 Or at least give up on the extra connection and have the clients use 9 base.getTableDefForTable(connection, tableName) directly. 10 """ 11 12 #c Copyright 2008-2019, the GAVO project 13 #c 14 #c This program is free software, covered by the GNU GPL. See the 15 #c COPYING file in the source distribution. 16 17 18 import functools 19 20 from gavo import base25 """decorates m such that any function call is retried after self.reset 26 is called. 27 """ 28 def f(self, *args, **kwargs): 29 try: 30 return m(self, *args, **kwargs) 31 except: 32 self.reset() 33 return m(self, *args, **kwargs)34 35 return functools.update_wrapper(f, m) 3639 """an interface to DaCHS meta tables. 40 41 This used to be a fairly complex interface to all sorts for DC-related 42 metadata. These day, the only thing it does is figure out where 43 table definitions reside and which are available for ADQL. This thing 44 has been a bad idea all around. 45 46 Though you can construct MetaTableHandlers of your own, you should 47 use base.caches.getMTH(None) when reading. 48 """ 52 568958 try: 59 self.readerConnection.close() 60 except base.InterfaceError: 61 # connection already closed 62 pass63 67 68 @_retryProtect70 """returns a TableDef for tableName. 71 72 As it is not a priori clear which RD a given table lives in, 73 this goes through dc.tablemeta to figure this out. The 74 object comes from the actual RD, though, so this might very well 75 trigger database action and RD loading. 76 """ 77 return base.getTableDefForTable( 78 self.readerConnection, 79 tableName)80 81 @_retryProtect83 """returns a list of all names of tables accessible through TAP in 84 this data center. 85 """ 86 return [r["tablename"] for r in 87 self.readerConnection.queryToDicts( 88 "select tablename from dc.tablemeta where adql")]92 return MetaTableHandler()93 94 base.caches.makeCache("getMTH", _getMetaTable) 95
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu May 2 07:29:09 2019 | http://epydoc.sourceforge.net |