python-dask/0003-fix-index_col-duplicat...

31 lines
944 B
Diff

From 57cf597227fb78a42cabbeedab146260e6f485e2 Mon Sep 17 00:00:00 2001
From: McToel <theo.doellmann@gmx.de>
Date: Sun, 16 May 2021 11:11:06 +0200
Subject: [PATCH 3/4] fix index_col duplication if index_col is type str
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
dask/dataframe/io/sql.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dask/dataframe/io/sql.py b/dask/dataframe/io/sql.py
index 112876e2..d698c494 100644
--- a/dask/dataframe/io/sql.py
+++ b/dask/dataframe/io/sql.py
@@ -125,10 +125,8 @@ def read_sql_table(
if columns
else list(table.columns)
)
- if index_col not in columns:
- columns.append(
- table.columns[index_col] if isinstance(index_col, str) else index_col
- )
+ if index not in columns:
+ columns.append(index)
if isinstance(index_col, str):
kwargs["index_col"] = index_col
--
2.31.1