[Feature/Addition] parsons.databases.database.DatabaseCreateStatement.detect_data_type() should detect more data types than str, float, int #942
Labels
enhancement
Impact - something should be added to or changed about Parsons that isn't causing a current breakage
medium priority
Priority - this doesn't need to be addressed immediately, but will broadly impact Parsons users
parsons.databases.database.DatabaseCreateStatement.detect_data_type()
is only able to currently detect data types str, float, and int. As a result, downstream methods (e.g.parsons.databases.redshift.rs_create_table.RedshiftCreateTable.data_type()
) that generate DDL statements to create database tables are only able to infer data types for database tables for these 3 types.It should be possible to infer types for more data types, including datetimes, dates, and booleans.
Detailed Description
Context
When using
parsons.Redshift.copy()
to upload a parsons Table into a Redshift database, parsons should be able to infer data types for most column types and pass those into Redshift accurately. However, the current implementation only accomplishes this for string, float, and integer types. All other types are coerced into strings. There should be enough information available in a parsons table to detect and accurately represent other types, including datetimes, dates, and booleans.Possible Implementation
postgres, mysql, and redshift database connectors all use the underlying
detect_data_type()
method, so whatever change is made here will need to be compatible with all 3 downstream connectors and SQL generators.Priority
The text was updated successfully, but these errors were encountered: