mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 17:26:55 +08:00
feat(datasource): optimize excel nan
This commit is contained in:
@@ -115,7 +115,8 @@ async def upload_excel(session: SessionDep, file: UploadFile = File(...)):
|
||||
create_table(conn, tableName, fields)
|
||||
|
||||
data = [
|
||||
{df.columns[i]: int(row[i]) if "int" in str(df.dtypes[i]) else row[i] for i in range(len(row))}
|
||||
{df.columns[i]: None if pd.isna(row[i]) else (int(row[i]) if "int" in str(df.dtypes[i]) else row[i])
|
||||
for i in range(len(row))}
|
||||
for row in df.values
|
||||
]
|
||||
# insert data
|
||||
@@ -135,7 +136,8 @@ async def upload_excel(session: SessionDep, file: UploadFile = File(...)):
|
||||
create_table(conn, tableName, fields)
|
||||
|
||||
data = [
|
||||
{df.columns[i]: int(row[i]) if "int" in str(df.dtypes[i]) else row[i] for i in range(len(row))}
|
||||
{df.columns[i]: None if pd.isna(row[i]) else (int(row[i]) if "int" in str(df.dtypes[i]) else row[i])
|
||||
for i in range(len(row))}
|
||||
for row in df.values
|
||||
]
|
||||
# insert data
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="onSuccess"
|
||||
>
|
||||
<el-button>Upload</el-button>
|
||||
<el-button :disabled="!isCreate">Upload</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
Only support .xls, .xlsx, .csv, size less than 50MB.
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
<div class="connection-actions">
|
||||
<el-button class="action-btn" circle @click="getTables(ds.id, ds.name)" :icon="List"/>
|
||||
<el-button class="action-btn" circle @click="editTables(ds)" :icon="CreditCard"/>
|
||||
<el-button v-if="ds.type !== 'excel'" type="primary" class="action-btn" circle @click="editDs(ds)"
|
||||
:icon="IconOpeEdit"/>
|
||||
<el-button type="primary" class="action-btn" circle @click="editDs(ds)" :icon="IconOpeEdit"/>
|
||||
<el-button type="danger" class="action-btn" circle @click="deleteDs(ds)" :icon="IconOpeDelete"/>
|
||||
</div>
|
||||
</DatasourceItemCard>
|
||||
|
||||
Reference in New Issue
Block a user