Skip to content

Commit c67ae75

Browse files
committed
ENH #6416 cleanup for PR
1 parent 6680b6b commit c67ae75

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

pandas/io/sql.py

+6-15
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"""
55
from __future__ import print_function, division
66
from datetime import datetime, date, timedelta
7+
78
import warnings
8-
from pandas.compat import lzip, map, zip, raise_with_traceback, string_types
9+
import itertools
910
import numpy as np
1011

1112
import pandas.core.common as com
13+
from pandas.compat import lzip, map, zip, raise_with_traceback, string_types
1214
from pandas.core.api import DataFrame
1315
from pandas.core.base import PandasObject
1416
from pandas.tseries.tools import to_datetime
@@ -432,7 +434,6 @@ def insert(self):
432434
data = dict((k, self.maybe_asscalar(v))
433435
for k, v in t[1].iteritems())
434436
data_list.append(data)
435-
#self.pd_sql.execute(ins, **data)
436437
self.pd_sql.execute(ins, data_list)
437438

438439
def read(self, coerce_float=True, parse_dates=None, columns=None):
@@ -548,30 +549,22 @@ def _harmonize_columns(self, parse_dates=None):
548549
def _sqlalchemy_type(self, arr_or_dtype):
549550
from sqlalchemy.types import Integer, Float, Text, Boolean, DateTime, Date, Interval
550551

551-
if isinstance(arr_or_dtype, np.dtype):
552-
tipo = arr_or_dtype
553-
elif isinstance(arr_or_dtype, type):
554-
tipo = np.dtype(arr_or_dtype)
555-
else:
556-
tipo = arr_or_dtype.dtype
557-
558552
if arr_or_dtype is date:
559553
return Date
560554
if com.is_datetime64_dtype(arr_or_dtype):
561555
try:
562556
tz = arr_or_dtype.tzinfo
563557
return DateTime(timezone=True)
564558
except:
565-
print('no tzinfo')
566559
return DateTime
567560
if com.is_timedelta64_dtype(arr_or_dtype):
568561
return Interval
569-
if com.is_float_dtype(arr_or_dtype):
562+
elif com.is_float_dtype(arr_or_dtype):
570563
return Float
571-
if com.is_integer_dtype(arr_or_dtype):
564+
elif com.is_integer_dtype(arr_or_dtype):
572565
# TODO: Refine integer size.
573566
return Integer
574-
if isinstance(tipo, np.bool_):
567+
elif com.is_bool(arr_or_dtype):
575568
return Boolean
576569
return Text
577570

@@ -769,8 +762,6 @@ def insert(self):
769762
data = [self.maybe_asscalar(v) for v in r[1].values]
770763
if self.index is not None:
771764
data.insert(0, self.maybe_asscalar(r[0]))
772-
print(type(data[2]))
773-
print(type(r[0]))
774765
cur.execute(ins, tuple(data))
775766
cur.close()
776767

0 commit comments

Comments
 (0)