Giter Site home page Giter Site logo

Comments (10)

smtakeda avatar smtakeda commented on June 2, 2024

do you mean on_error='%s' where %s can be either one of them?

CONTINUE | SKIP_FILE | SKIP_FILE_num | SKIP_FILE_num% | ABORT_STATEMENT

?
I assume this change is used for Talend Connector.

from snowflake-jdbc.

olhava avatar olhava commented on June 2, 2024

Yes, @smtakeda, this is correct.

from snowflake-jdbc.

olhava avatar olhava commented on June 2, 2024

@smtakeda, I added pull requests for 2 possible solutions:
#36
#37

from snowflake-jdbc.

smtakeda avatar smtakeda commented on June 2, 2024

@olhava what behavior do you expect when the error occurs? For example, COPY with ABORT_TRANSACTION will raise an SQL error if an invalid data are included in the source. Do you want the API to raise the exception as is?

from snowflake-jdbc.

smtakeda avatar smtakeda commented on June 2, 2024

Adding a test case. This is the expected error. if this works, I'll commit the change and release next week.

    StreamLoader underTest = ...
    try
    {
      underTest.finish();
      fail("should raise an exception");
    }
    catch (Loader.ConnectionError ex)
    {
      assertThat(ex.getCause() instanceof SQLException, equalTo(Boolean.TRUE));
      SQLException sqlEx = (SQLException) ex.getCause();
      assertThat(sqlEx.getErrorCode(), equalTo(100038));
    }

from snowflake-jdbc.

olhava avatar olhava commented on June 2, 2024

@smtakeda Yes, in case error occurs with on_error = ABORT_TRANSACTION, it's okay to throw Loader.ConnectionError.

One more concern in case of onErrorNumPercents, I did not find the documentation about the type of percentage value. I've set the type as Integer in my pull request, maybe it should be changed to Float if it is allowed.

from snowflake-jdbc.

smtakeda avatar smtakeda commented on June 2, 2024

@olhava sounds good.
I'm making the parameter to a single string type and validate them when specified. It may not be the best, but I don't want to clutter the parameters only for ON_ERROR option:

The validation will be done with this regex:

private final static Pattern validPattern = Pattern.compile(
    "(?:ABORT_STATEMENT|CONTINUE|SKIP_FILE(?:_\\d+%?)?)"

from snowflake-jdbc.

smtakeda avatar smtakeda commented on June 2, 2024

Btw, I'm going to remove copyEmptyFieldAsEmpty. It turned out it is no longer useful as I fixed the default behavior where null and empty data are treated as is instead of converting to null at all times:
f8b07f6

from snowflake-jdbc.

howryu avatar howryu commented on June 2, 2024

Fixed in f3469af

from snowflake-jdbc.

smtakeda avatar smtakeda commented on June 2, 2024

Actually the fix is already out.

from snowflake-jdbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.