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
No related branches found
No related tags found
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 { ...@@ -112,6 +112,8 @@ public abstract class JdbcConnector implements DatabaseConnector {
log.warn("No data provided."); log.warn("No data provided.");
throw new TableMalformedException("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()) { if (data.getData().get(0).size() != table.getColumns().size()) {
log.error("Provided columns differ from table columns found in metadata db."); 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."); throw new TableMalformedException("Provided columns differ from table columns found in metadata db.");
...@@ -138,9 +140,11 @@ public abstract class JdbcConnector implements DatabaseConnector { ...@@ -138,9 +140,11 @@ public abstract class JdbcConnector implements DatabaseConnector {
.values(row)); .values(row));
} }
try { try {
log.trace("insertCsv statements {}", statements);
context.batch(statements) context.batch(statements)
.execute(); .execute();
} catch (DataAccessException e) { } 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); 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 { ...@@ -54,7 +54,8 @@ export default {
plugins: [ plugins: [
{ src: '~/plugins/toast', ssr: false }, { 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) // Auto import components (https://go.nuxtjs.dev/config-components)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<v-card-title v-if="!loading"> <v-card-title v-if="!loading">
Import Data Import Data
</v-card-title> </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-card-text>
<v-checkbox <v-checkbox
v-model="tableInsert.skipHeader" v-model="tableInsert.skipHeader"
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
loading: false, loading: false,
table: { table: {
name: null, name: null,
internal_name: null internalName: null
}, },
tableInsert: { tableInsert: {
skipHeader: false, skipHeader: false,
...@@ -76,6 +76,7 @@ export default { ...@@ -76,6 +76,7 @@ export default {
} catch (err) { } catch (err) {
console.error('Could not insert data.', err) console.error('Could not insert data.', err)
} }
this.loading = false
}, },
async upload () { async upload () {
this.loading = true this.loading = true
...@@ -97,7 +98,7 @@ export default { ...@@ -97,7 +98,7 @@ export default {
console.error('Could not upload data.', err) console.error('Could not upload data.', err)
return return
} }
const insertUrl = `/api/database/${this.databaseId}/table/${this.tableId}/data` const insertUrl = `/api/database/${this.databaseId}/table/${this.tableId}/data/csv`
let insertResult let insertResult
try { try {
insertResult = await this.$axios.post(insertUrl, this.tableInsert) insertResult = await this.$axios.post(insertUrl, this.tableInsert)
......
...@@ -38,6 +38,7 @@ export default { ...@@ -38,6 +38,7 @@ export default {
data () { data () {
return { return {
loading: true, loading: true,
page: 0,
table: { table: {
name: null, name: null,
description: null description: null
...@@ -75,7 +76,9 @@ export default { ...@@ -75,7 +76,9 @@ export default {
}, },
async loadData () { async loadData () {
try { 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 this.rows = res.data.result
console.debug('table data', res.data) console.debug('table data', res.data)
} catch (err) { } 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