Example #1
0
 def _fill_metadata_from_sample(self, col):
     col['pytype'] = type(col['sample_datum'])
     if isinstance(col['sample_datum'], Decimal):
         col['satype'] = sa.DECIMAL(*th.precision_and_scale(col['sample_datum']))
     elif isinstance(col['sample_datum'], str):
         if self.varying_length_text:
             col['satype'] = sa.Text()
         else:
             col['satype'] = sa.Unicode(len(col['sample_datum']))
     else:
         col['satype'] = self.types2sa[type(col['sample_datum'])]
     return col
Example #2
0
 def _fill_metadata_from_sample(self, col):
     col['pytype'] = type(col['sample_datum'])
     if isinstance(col['sample_datum'], Decimal):
         col['satype'] = sa.DECIMAL(*th.precision_and_scale(col['sample_datum']))
     elif isinstance(col['sample_datum'], str):
         if self.varying_length_text:
             col['satype'] = sa.Text()
         else:
             col['satype'] = sa.Unicode(len(col['sample_datum']))
     else:
         col['satype'] = self.types2sa[type(col['sample_datum'])]        
     return col
Example #3
0
 def _fill_metadata_from_sample(self, col):
     col['pytype'] = type(col['sample_datum'])
     if isinstance(col['sample_datum'], Decimal):
         (precision, scale) = th.precision_and_scale(col['sample_datum'])
         col['satype'] = sa.DECIMAL(precision + self.data_size_cushion*2, 
                                    scale + self.data_size_cushion)
     elif isinstance(col['sample_datum'], str):
         if self.varying_length_text:
             col['satype'] = sa.Text()
         else:
             str_len = max(len(col['sample_datum']), col['str_length'])
             col['satype'] = sa.Unicode(str_len+self.data_size_cushion*2)
     else:
         col['satype'] = self.types2sa[type(col['sample_datum'])]
         if col['satype'] == sa.Integer and (
             col['sample_datum'] > (2147483647-self.data_size_cushion*1000000000) or 
             col['sample_datum'] < (-2147483647+self.data_size_cushion*1000000000)):
             col['satype'] = sa.BigInteger
     return col
Example #4
0
 def _fill_metadata_from_sample(self, col):
     col['pytype'] = type(col['sample_datum'])
     if isinstance(col['sample_datum'], Decimal):
         (precision, scale) = th.precision_and_scale(col['sample_datum'])
         col['satype'] = sa.DECIMAL(precision + self.data_size_cushion * 2,
                                    scale + self.data_size_cushion)
     elif isinstance(col['sample_datum'], str):
         if self.varying_length_text:
             col['satype'] = sa.Text()
         else:
             str_len = max(len(col['sample_datum']), col['str_length'])
             col['satype'] = sa.Unicode(str_len +
                                        self.data_size_cushion * 2)
     else:
         col['satype'] = self.types2sa[type(col['sample_datum'])]
         if col['satype'] == sa.Integer and (
                 col['sample_datum'] >
             (2147483647 - self.data_size_cushion * 1000000000)
                 or col['sample_datum'] <
             (-2147483647 + self.data_size_cushion * 1000000000)):
             col['satype'] = sa.BigInteger
     return col