Skip to content

Exasol: IMPORT/EXPORT #2256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3e18bd0
feat: Implement IMPORT statement grammar
Feb 3, 2025
482a993
feat: Classify new keywords in ParserKeywordsUtils
Feb 3, 2025
dcea88f
feat: Implement java classes for IMPORT statement
Feb 4, 2025
e1a74e1
feat: Add LOOKAHEADs for IMPORT statement
Feb 4, 2025
711200d
fix: Fix issues in IMPORT implementation
Feb 4, 2025
b0e6276
feat: Update keywords
Feb 5, 2025
0c9b80e
feat: Allow IMPORT as FromItem in SELECT
Feb 5, 2025
d412059
fix: Split double dot to fix broken unit tests
Feb 6, 2025
bcfa4e9
fix: Fix errors occured during verify step
Feb 6, 2025
0130d56
test: Implement unit tests for IMPORT
Feb 7, 2025
7437a75
feat: Simplify grammar
Feb 7, 2025
f495c96
test: Implement test for sub IMPORT
Feb 7, 2025
431a046
Merge branch 'master' into feature/exasol-import-statement
Feb 7, 2025
60bb98d
fix: Use double dot token in IMPORT
Feb 7, 2025
34fc6dd
feat: Implement EXPORT statement
Feb 7, 2025
c4e5907
refactor: Fix file extension in IMPORT tests
Feb 10, 2025
c1129a0
test: Implement unit tests for EXPORT statement
Feb 10, 2025
34791cf
feat: Implement classes for EXPORT statement
Feb 10, 2025
c658f4d
test: Fix EXPORT unit tests
Feb 11, 2025
9a71180
Merge branch 'master' into feature/exasol-import-export
Jun 2, 2025
8adaa89
fix: Implement missing SampleClause methods
Jun 2, 2025
0c132d0
feat: Add further Import tests
Jun 4, 2025
3d1b786
fix: Update Keywords and fix boolean data type matching
Jun 4, 2025
223143a
fix: Fix SourceDestinationType implementations
Jun 4, 2025
40f916d
style: Run spotlessApply
Jun 5, 2025
b56565d
fix: Fix spotbugsMain
Jun 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
exports net.sf.jsqlparser.statement.delete;
exports net.sf.jsqlparser.statement.drop;
exports net.sf.jsqlparser.statement.execute;
exports net.sf.jsqlparser.statement.export;
exports net.sf.jsqlparser.statement.grant;
exports net.sf.jsqlparser.statement.imprt;
exports net.sf.jsqlparser.statement.insert;
exports net.sf.jsqlparser.statement.merge;
exports net.sf.jsqlparser.statement.piped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class ParserKeywordsUtils {
{"CHECK", RESTRICTED_SQL2016},
{"CONNECT", RESTRICTED_ALIAS},
{"CONNECT_BY_ROOT", RESTRICTED_JSQLPARSER},
{"CSV", RESTRICTED_JSQLPARSER},
{"PRIOR", RESTRICTED_JSQLPARSER},
{"CONSTRAINT", RESTRICTED_SQL2016},
{"CREATE", RESTRICTED_ALIAS},
Expand All @@ -65,12 +66,15 @@ public class ParserKeywordsUtils {
{"DISTINCT", RESTRICTED_SQL2016},
{"DOUBLE", RESTRICTED_ALIAS},
{"ELSE", RESTRICTED_JSQLPARSER},
{"ERRORS", RESTRICTED_JSQLPARSER},
{"EXCEPT", RESTRICTED_SQL2016},
{"EXCLUDES", RESTRICTED_JSQLPARSER},
{"EXISTS", RESTRICTED_SQL2016},
{"EXTEND", RESTRICTED_JSQLPARSER},
{"FALSE", RESTRICTED_SQL2016},
{"FBV", RESTRICTED_JSQLPARSER},
{"FETCH", RESTRICTED_SQL2016},
{"FILE", RESTRICTED_JSQLPARSER},
{"FINAL", RESTRICTED_JSQLPARSER},
{"FOR", RESTRICTED_SQL2016},
{"FORCE", RESTRICTED_SQL2016},
Expand All @@ -86,6 +90,7 @@ public class ParserKeywordsUtils {
{"IIF", RESTRICTED_ALIAS},
{"IGNORE", RESTRICTED_ALIAS},
{"ILIKE", RESTRICTED_SQL2016},
{"IMPORT", RESTRICTED_JSQLPARSER},
{"IN", RESTRICTED_SQL2016},
{"INCLUDES", RESTRICTED_JSQLPARSER},
{"INNER", RESTRICTED_SQL2016},
Expand Down Expand Up @@ -121,12 +126,14 @@ public class ParserKeywordsUtils {
{"RETURNING", RESTRICTED_JSQLPARSER},
{"RIGHT", RESTRICTED_SQL2016},
{"SAMPLE", RESTRICTED_ALIAS},
{"SCRIPT", RESTRICTED_JSQLPARSER},
{"SEL", RESTRICTED_ALIAS},
{"SELECT", RESTRICTED_ALIAS},
{"SEMI", RESTRICTED_JSQLPARSER},
{"SET", RESTRICTED_JSQLPARSER},
{"SOME", RESTRICTED_JSQLPARSER},
{"START", RESTRICTED_JSQLPARSER},
{"STATEMENT", RESTRICTED_JSQLPARSER},
{"TABLES", RESTRICTED_ALIAS},
{"TOP", RESTRICTED_SQL2016},
{"TRAILING", RESTRICTED_SQL2016},
Expand All @@ -146,6 +153,7 @@ public class ParserKeywordsUtils {
{"VALUE", RESTRICTED_JSQLPARSER},
{"VALUES", RESTRICTED_SQL2016},
{"VARYING", RESTRICTED_JSQLPARSER},
{"VERIFY", RESTRICTED_JSQLPARSER},
{"WHEN", RESTRICTED_SQL2016},
{"WHERE", RESTRICTED_SQL2016},
{"WINDOW", RESTRICTED_SQL2016},
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/sf/jsqlparser/parser/feature/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,11 @@ public enum Feature {
* allows sub selects without parentheses, e.g. `select * from dual where 1 = select 1`
*/
allowUnparenthesizedSubSelects(false),

/**
* "IMPORT"
*/
imprt,
;

private final Object value;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jsqlparser/schema/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.sf.jsqlparser.expression.MySQLIndexHint;
import net.sf.jsqlparser.expression.SQLServerHints;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.ErrorDestination;
import net.sf.jsqlparser.statement.select.FromItem;
import net.sf.jsqlparser.statement.select.FromItemVisitor;
import net.sf.jsqlparser.statement.select.IntoTableVisitor;
Expand All @@ -27,7 +28,7 @@
/**
* A table. It can have an alias and the schema name it belongs to.
*/
public class Table extends ASTNodeAccessImpl implements FromItem, MultiPartName {
public class Table extends ASTNodeAccessImpl implements ErrorDestination, FromItem, MultiPartName {

// private Database database;
// private String schemaName;
Expand Down
91 changes: 91 additions & 0 deletions src/main/java/net/sf/jsqlparser/statement/CSVColumn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2022 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.statement;

import net.sf.jsqlparser.expression.StringValue;

public class CSVColumn {
private Long startIndex;
private Long endIndex;
private StringValue format;
private String delimit;

public CSVColumn(Long startIndex, Long endIndex) {
this.startIndex = startIndex;
this.endIndex = endIndex;
}

public CSVColumn(Long index) {
this(index, null);
}

public Long getStartIndex() {
return startIndex;
}

public void setStartIndex(Long startIndex) {
this.startIndex = startIndex;
}

public Long getIndex() {
return getStartIndex();
}

public void setIndex(Long index) {
setStartIndex(index);
}

public Long getEndIndex() {
return endIndex;
}

public void setEndIndex(Long endIndex) {
this.endIndex = endIndex;
}

public StringValue getFormat() {
return format;
}

public void setFormat(StringValue format) {
this.format = format;
}

public String getDelimit() {
return delimit;
}

public void setDelimit(String delimit) {
this.delimit = delimit;
}

@Override
public String toString() {
StringBuilder sql = new StringBuilder();

sql.append(startIndex);
if (endIndex != null) {
sql.append(" .. ");
sql.append(endIndex);
} else if (format != null || delimit != null) {
if (format != null) {
sql.append(" FORMAT = ");
sql.append(format);
}

if (delimit != null) {
sql.append(" DELIMIT = ");
sql.append(delimit);
}
}

return sql.toString();
}
}
75 changes: 75 additions & 0 deletions src/main/java/net/sf/jsqlparser/statement/CSVFileDestination.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2022 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.statement;

import net.sf.jsqlparser.expression.StringValue;

public class CSVFileDestination implements ErrorDestination {
private ConnectionDefinition connectionDefinition;
private boolean local;
private boolean secure;
private StringValue file;

public ConnectionDefinition getConnectionDefinition() {
return connectionDefinition;
}

public void setConnectionDefinition(ConnectionDefinition connectionDefinition) {
this.connectionDefinition = connectionDefinition;
}

public boolean isLocal() {
return local;
}

public void setLocal(boolean local) {
this.local = local;
}

public boolean isSecure() {
return secure;
}

public void setSecure(boolean secure) {
this.secure = secure;
}

public StringValue getFile() {
return file;
}

public void setFile(StringValue file) {
this.file = file;
}

@Override
public String toString() {
StringBuilder sql = new StringBuilder();

if (local) {
sql.append("LOCAL ");
if (secure) {
sql.append("SECURE ");
}
}

sql.append("CSV");

if (connectionDefinition != null) {
sql.append(" ");
sql.append(connectionDefinition);
}

sql.append(" FILE ");
sql.append(file);

return sql.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2025 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.statement;

import net.sf.jsqlparser.expression.StringValue;

import java.io.Serializable;

public class CertificateVerification implements Serializable {
private Boolean ignoreCertificate;
private StringValue publicKey;

public StringValue getPublicKey() {
return publicKey;
}

public void setPublicKey(StringValue publicKey) {
this.publicKey = publicKey;
}

public Boolean getIgnoreCertificate() {
return ignoreCertificate;
}

public void setIgnoreCertificate(Boolean ignoreCertificate) {
this.ignoreCertificate = ignoreCertificate;
}

public Boolean getVerifyCertificate() {
return !ignoreCertificate;
}

public void setVerifyCertificate(Boolean verifyCertificate) {
this.ignoreCertificate = !verifyCertificate;
}

@Override
public String toString() {
StringBuilder sql = new StringBuilder();

if (ignoreCertificate != null) {
if (ignoreCertificate) {
sql.append("IGNORE ");
} else {
sql.append("VERIFY ");
}
sql.append("CERTIFICATE");
}

if (publicKey != null) {
if (ignoreCertificate != null) {
sql.append(" ");
}
sql.append("PUBLIC KEY ");
sql.append(publicKey);
}

return sql.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2022 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.statement;

public class CloudConnectionDefinition extends ConnectionDefinition {
private String storage;

public String getStorage() {
return storage;
}

public void setStorage(String storage) {
this.storage = storage;
}

@Override
public void setCertificateVerification(CertificateVerification certificateVerification) {}

@Override
public String toString() {
StringBuilder sql = new StringBuilder();

sql.append("AT CLOUD ");
sql.append(storage);
sql.append(" ");
appendConnectionDefinition(sql);

return sql.toString();
}
}
Loading
Loading