CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
data_sources.sqlite_schema Class Reference
Inheritance diagram for data_sources.sqlite_schema:
data_sources.data_source data_sources.node

Public Member Functions

def __init__
 
def data
 
- Public Member Functions inherited from data_sources.data_source
def __init__
 
def __repr__
 
def get_data
 
- Public Member Functions inherited from data_sources.node
def __init__
 
def __str__
 
def add_child
 
def child
 
def children
 
def data
 
def is_leaf
 
def left_child
 
def right_child
 

Private Attributes

 _data
 
 _file_name
 

Detailed Description

Definition at line 124 of file data_sources.py.

Constructor & Destructor Documentation

def data_sources.sqlite_schema.__init__ (   self,
  sqlite_file_name 
)

Definition at line 126 of file data_sources.py.

127  def __init__(self, sqlite_file_name):
128  self._file_name = sqlite_file_name
129  try:
130  # import sqlite3 and connect to the database file
131  import sqlite3
132  connection = sqlite3.connect(self._file_name)
133  cursor = connection.cursor()
134  if query_object == None:
135  # try to query the file to get table and column data
136  tables = cursor.execute("select name from sqlite_master where type = 'table'")
137 
138  # now build a mapping of tables to columns - with a dictionary
139  table_to_columns = {}
140  for table in tables.fetchall():
141  table_to_columns[table[0]] = []
142  # now query columns for this table
143  columns = cursor.execute("pragma table_info(%s)" % table[0])
144  for column in columns.fetchall():
145  table_to_columns[table[0]].append(str(column[1]))
146 
147  # now query with the mapping
148  table_to_data = {}
149  for table in table_to_columns:
150  # query with all columns
151  column_string = ",".join(table_to_columns[table])
152  sql_query = "select %s from %s" % (column_string, table)
153  results = cursor.execute(sql_query).fetchall()
154  for n in range(0, len(results)):
155  results[n] = dict(zip(table_to_columns[table], map(str, results[n])))
156  table_to_data[str(table)] = results
157  self._data = json_data_node.make(table_to_data)
158  else:
159  sql_query = query_object.to_sql()
160 
161  except IOError as io:
162  exit("Couldn't open the file '%s'" % self._file_name)
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Function Documentation

def data_sources.sqlite_schema.data (   self)

Definition at line 163 of file data_sources.py.

References data_sources.node._data, and HcalTriggerKey._data.

Referenced by cuy.FindIssue.__init__(), data_sources.json_list.as_dicts(), data_sources.json_list.as_table(), and data_sources.json_list.last().

164  def data(self):
165  return self._data
166 
167 # used for chaining json-navigation methods
168 # when a method is called initially on the data, an object of this class is returned,
# then the methods on that object return an object of this class again.

Member Data Documentation

data_sources.sqlite_schema._data
private

Definition at line 156 of file data_sources.py.

Referenced by XML2Python.DataNode.__init__(), data_sources.json_data_node.__init__(), python.XML2Python.DataNode.__nonzero__(), XML2Python.DataNode.__nonzero__(), python.XML2Python.DataNode.__repr__(), XML2Python.DataNode.__repr__(), XML2Python.DataNode.__str__(), python.XML2Python.DataNode.__str__(), data_sources.json_data_node.__str__(), cfg-viewer.unscheduled._proceed(), cfg-viewer.unscheduled._saveData(), data_sources.json_dict.add_key(), data_sources.json_data_node.data(), data_sources.json_data_node.find(), data_sources.json_list.next(), data_sources.json_data_node.raw(), data_sources.json_data_node.set(), and XML2Python.DataNode.stringify().

data_sources.sqlite_schema._file_name
private

Definition at line 127 of file data_sources.py.