Skip to content

Commit 6330e37

Browse files
committed
Standardize SQLAlchemy types.
1 parent 7d2106f commit 6330e37

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

awswrangler/_data_types.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ def pyarrow2sqlalchemy( # pylint: disable=too-many-branches,too-many-return-sta
175175
) -> Optional[VisitableType]:
176176
"""Pyarrow to Athena data types conversion."""
177177
if pa.types.is_int8(dtype):
178-
return sqlalchemy.types.SmallInteger
178+
return sqlalchemy.types.SMALLINT
179179
if pa.types.is_int16(dtype):
180-
return sqlalchemy.types.SmallInteger
180+
return sqlalchemy.types.SMALLINT
181181
if pa.types.is_int32(dtype):
182-
return sqlalchemy.types.Integer
182+
return sqlalchemy.types.INTEGER
183183
if pa.types.is_int64(dtype):
184-
return sqlalchemy.types.BigInteger
184+
return sqlalchemy.types.BIGINT
185185
if pa.types.is_float32(dtype):
186-
return sqlalchemy.types.Float
186+
return sqlalchemy.types.FLOAT
187187
if pa.types.is_float64(dtype):
188188
if db_type == "mysql":
189189
return sqlalchemy.dialects.mysql.DOUBLE
@@ -195,25 +195,25 @@ def pyarrow2sqlalchemy( # pylint: disable=too-many-branches,too-many-return-sta
195195
f"{db_type} is a invalid database type, please choose between postgresql, mysql and redshift."
196196
) # pragma: no cover
197197
if pa.types.is_boolean(dtype):
198-
return sqlalchemy.types.Boolean
198+
return sqlalchemy.types.BOOLEAN
199199
if pa.types.is_string(dtype):
200200
if db_type == "mysql":
201-
return sqlalchemy.types.Text
201+
return sqlalchemy.types.TEXT
202202
if db_type == "postgresql":
203-
return sqlalchemy.types.Text
203+
return sqlalchemy.types.TEXT
204204
if db_type == "redshift":
205205
return sqlalchemy.types.VARCHAR(length=256)
206206
raise exceptions.InvalidDatabaseType(
207207
f"{db_type} is a invalid database type. " f"Please choose between postgresql, mysql and redshift."
208208
) # pragma: no cover
209209
if pa.types.is_timestamp(dtype):
210-
return sqlalchemy.types.DateTime
210+
return sqlalchemy.types.DATETIME
211211
if pa.types.is_date(dtype):
212-
return sqlalchemy.types.Date
212+
return sqlalchemy.types.DATE
213213
if pa.types.is_binary(dtype):
214214
if db_type == "redshift":
215215
raise exceptions.UnsupportedType("Binary columns are not supported for Redshift.") # pragma: no cover
216-
return sqlalchemy.types.Binary
216+
return sqlalchemy.types.BINARY
217217
if pa.types.is_decimal(dtype):
218218
return sqlalchemy.types.Numeric(precision=dtype.precision, scale=dtype.scale)
219219
if pa.types.is_dictionary(dtype):

0 commit comments

Comments
 (0)