OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
create_table.Column Class Reference

Public Member Functions

def __init__
 
def generateEntry
 
def generateInt
 
def createColumnDetailsString
 

Public Attributes

 column_name
 
 sql_type
 
 lower_bound
 
 upper_bound
 
 step
 

Detailed Description

Definition at line 11 of file create_table.py.

Constructor & Destructor Documentation

def create_table.Column.__init__ (   self,
  column_name,
  sql_type,
  lower,
  upper,
  step = 1 
)

Definition at line 12 of file create_table.py.

12 
13  def __init__(self, column_name, sql_type, lower, upper, step=1):
14  self.column_name = column_name
15  assert sql_type.upper() in ["INT", "BIGINT"]
16  self.sql_type = sql_type.upper()
17  assert upper > lower
18  self.lower_bound = lower
19  self.upper_bound = upper
20  assert step >= 1
21  self.step = step
22  if self.sql_type in ["INT"]:
23  assert (
24  self.upper_bound * step <= 2 ** 31
25  ), "Generated values are larger than 32-bit signed integer."

Member Function Documentation

def create_table.Column.createColumnDetailsString (   self)
Returns the ColumnDetails as expected by pymapd's API

Definition at line 35 of file create_table.py.

References create_table.Column.column_name.

35 
36  def createColumnDetailsString(self):
37  """
38  Returns the ColumnDetails as expected by pymapd's API
39  """
40  result = "ColumnDetails(name='"
41  result += self.column_name
42  result += "', type='"
43  result += self.sql_type.upper()
44  result += "', nullable=True, precision=0, scale=0, comp_param=0, encoding='NONE', is_array=False)"
45  return result
46 
def create_table.Column.generateEntry (   self)

Definition at line 26 of file create_table.py.

References create_table.Column.generateInt(), create_table.Column.sql_type, and create_table.Column.step.

26 
27  def generateEntry(self):
28  if self.sql_type in ["INT", "BIGINT"]:
29  return self.generateInt() * self.step
30  else:
31  assert False, "SQL type " + self.sql_type + " not supported yet"

+ Here is the call graph for this function:

def create_table.Column.generateInt (   self)

Definition at line 32 of file create_table.py.

References create_table.Column.lower_bound, and create_table.Column.upper_bound.

Referenced by create_table.Column.generateEntry().

32 
33  def generateInt(self):
34  return int(random.randint(self.lower_bound, self.upper_bound))

+ Here is the caller graph for this function:

Member Data Documentation

create_table.Column.column_name

Definition at line 13 of file create_table.py.

Referenced by create_table.Column.createColumnDetailsString().

create_table.Column.lower_bound

Definition at line 17 of file create_table.py.

Referenced by create_table.Column.generateInt().

create_table.Column.sql_type

Definition at line 15 of file create_table.py.

Referenced by create_table.Column.generateEntry().

create_table.Column.step

Definition at line 20 of file create_table.py.

Referenced by create_table.Column.generateEntry().

create_table.Column.upper_bound

Definition at line 18 of file create_table.py.

Referenced by create_table.Column.generateInt().


The documentation for this class was generated from the following file: