Skip to content
Snippets Groups Projects
Verified Commit 34c4aa26 authored by Kirill Stytsenko's avatar Kirill Stytsenko
Browse files

Add logging to insertCsv

closes #110
parent 3e38be1a
Branches
Tags
3 merge requests!81New stable release,!43Merge dev to master,!33Draft: merge dev to master
......@@ -112,6 +112,8 @@ public abstract class JdbcConnector implements DatabaseConnector {
log.warn("No data provided.");
throw new TableMalformedException("No data provided");
}
log.info("First row {}", data.getData().get(0));
log.info("Table columns {}", table.getColumns());
if (data.getData().get(0).size() != table.getColumns().size()) {
log.error("Provided columns differ from table columns found in metadata db.");
throw new TableMalformedException("Provided columns differ from table columns found in metadata db.");
......@@ -138,9 +140,11 @@ public abstract class JdbcConnector implements DatabaseConnector {
.values(row));
}
try {
log.trace("insertCsv statements {}", statements);
context.batch(statements)
.execute();
} catch (DataAccessException e) {
log.error("DataAccessException {}", e);
throw new TableMalformedException("Columns seem to differ or other problem with jOOQ mapper, most commonly it is a data type issue try with type 'STRING'", e);
}
}
......
......@@ -54,7 +54,8 @@ export default {
plugins: [
{ src: '~/plugins/toast', ssr: false },
{ src: '~/plugins/vendors', ssr: false }
{ src: '~/plugins/vendors', ssr: false },
{ src: '~/plugins/axios' }
],
// Auto import components (https://go.nuxtjs.dev/config-components)
......
......@@ -4,7 +4,7 @@
<v-card-title v-if="!loading">
Import Data
</v-card-title>
<v-card-subtitle>{{ table.name }} ({{ table.internal_name }})</v-card-subtitle>
<v-card-subtitle>{{ table.name }} ({{ table.internalName }})</v-card-subtitle>
<v-card-text>
<v-checkbox
v-model="tableInsert.skipHeader"
......@@ -43,7 +43,7 @@ export default {
loading: false,
table: {
name: null,
internal_name: null
internalName: null
},
tableInsert: {
skipHeader: false,
......@@ -76,6 +76,7 @@ export default {
} catch (err) {
console.error('Could not insert data.', err)
}
this.loading = false
},
async upload () {
this.loading = true
......@@ -97,7 +98,7 @@ export default {
console.error('Could not upload data.', err)
return
}
const insertUrl = `/api/database/${this.databaseId}/table/${this.tableId}/data`
const insertUrl = `/api/database/${this.databaseId}/table/${this.tableId}/data/csv`
let insertResult
try {
insertResult = await this.$axios.post(insertUrl, this.tableInsert)
......
......@@ -38,6 +38,7 @@ export default {
data () {
return {
loading: true,
page: 0,
table: {
name: null,
description: null
......@@ -75,7 +76,9 @@ export default {
},
async loadData () {
try {
const res = await this.$axios.get(`/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/data`)
let url = `/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/data`
url += `?page=${this.page}&size=10`
const res = await this.$axios.get(url)
this.rows = res.data.result
console.debug('table data', res.data)
} catch (err) {
......
export default function ({ $axios, redirect }) {
console.log('axios intercepter args', arguments)
}
// export default function (item) {
// $axios.onError(error => {
// if(error.response.status === 500) {
// redirect('/sorry')
// }
// })
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment