OmniSciDB  0b528656ed
create_table.Column Class Reference

Public Member Functions

def __init__ (self, column_name, sql_type, lower, upper, step=1)
 
def generateEntry (self)
 
def generateInt (self)
 
def createColumnDetailsString (self)
 

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

◆ __init__()

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

Definition at line 12 of file create_table.py.

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

Member Function Documentation

◆ createColumnDetailsString()

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, and create_table.Column.sql_type.

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

◆ generateEntry()

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  def generateEntry(self):
27  if self.sql_type in ["INT", "BIGINT"]:
28  return self.generateInt() * self.step
29  else:
30  assert False, "SQL type " + self.sql_type + " not supported yet"
31 
+ Here is the call graph for this function:

◆ generateInt()

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  def generateInt(self):
33  return int(random.randint(self.lower_bound, self.upper_bound))
34 
+ Here is the caller graph for this function:

Member Data Documentation

◆ column_name

create_table.Column.column_name

Definition at line 13 of file create_table.py.

Referenced by create_table.Column.createColumnDetailsString().

◆ lower_bound

create_table.Column.lower_bound

Definition at line 17 of file create_table.py.

Referenced by create_table.Column.generateInt().

◆ sql_type

create_table.Column.sql_type

◆ step

create_table.Column.step

Definition at line 20 of file create_table.py.

Referenced by create_table.Column.generateEntry().

◆ upper_bound

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: