PERF: enable nullable integer for read_sql via parameter #40239
Closed
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Function
pandas.read_sqlread SQL query or database table into a DataFrame. However, for nullable integer columns, once there exists one row with null, pandas will infer this column as float, which may lead to subsequent issues (in our case, we use DataFrame for ETL and the integer converted to float, not suitable for our sink database table schema).Using nullable integer is one of the solution we adopted, which may cause more memory usage. Therefore, I add default False parameter for
pandas.read_sqlto not enable it as default, once you want to enable it, just set it as True.