CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 79 of file data_sources.py.

Constructor & Destructor Documentation

def data_sources.sqlite_schema.__init__ (   self,
  sqlite_file_name 
)

Definition at line 81 of file data_sources.py.

81 
82  def __init__(self, sqlite_file_name):
83  self._file_name = sqlite_file_name
84  # import sqlite3 and connect to the database file
85  import sqlite3
86  connection = sqlite3.connect(self._file_name)
87  cursor = connection.cursor()
88  if query_object == None:
89  # try to query the file to get table and column data
90  tables = cursor.execute("select name from sqlite_master where type = 'table'")
91 
92  # now build a mapping of tables to columns - with a dictionary
93  table_to_columns = {}
94  for table in tables.fetchall():
95  table_to_columns[table[0]] = []
96  # now query columns for this table
97  columns = cursor.execute("pragma table_info(%s)" % table[0])
98  for column in columns.fetchall():
99  table_to_columns[table[0]].append(str(column[1]))
100 
101  # now query with the mapping
102  table_to_data = {}
103  for table in table_to_columns:
104  # query with all columns
105  column_string = ",".join(table_to_columns[table])
106  sql_query = "select %s from %s" % (column_string, table)
107  results = cursor.execute(sql_query).fetchall()
108  for n in range(0, len(results)):
109  results[n] = dict(list(zip(table_to_columns[table], list(map(str, results[n])))))
110  table_to_data[str(table)] = results
111  self._data = json_data_node.make(table_to_data)
112  else:
113  sql_query = query_object.to_sql()
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 ...
const uint16_t range(const Frame &aFrame)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
#define str(s)

Member Function Documentation

def data_sources.sqlite_schema.data (   self)

Definition at line 114 of file data_sources.py.

References data_sources.node._data.

Referenced by data_sources.json_list.as_dicts(), data_sources.json_list.as_table(), data_sources.json_list.get_members(), and data_sources.json_list.last().

115  def data(self):
116  return self._data
117 
118 # used for chaining json-navigation methods
119 # 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 110 of file data_sources.py.

Referenced by XML2Python.DataNode.__init__(), data_sources.json_data_node.__init__(), data_sources.json_list.__next__(), 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__(), data_sources.json_dict.add_key(), data_sources.json_data_node.data(), data_sources.json_data_node.find(), 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 82 of file data_sources.py.