Giter Club home page Giter Club logo

data-utils's Introduction

data-utils

Groovy data utils. The main issue I needed to address was the reliance on System classloader in @Grab to handle JDBC drivers. This is very inconvenient when using an IDE such as Gade and Ride as it requires you to copy jars to the lib folder and restart the IDE in order for the System classpath to be updated.

However, with some Reflection magic it is possible to do without this. This is what se.alipsa.groovy.datautil.SqlUtil does.

Here is an example:

@Grab('se.alipsa.groovy:data-utils:1.0.5')
@Grab('org.postgresql:postgresql:42.4.0')

import se.alipsa.groovy.datautil.SqlUtil

def idList = new ArrayList()

SqlUtil.withInstance("jdbc:postgresql://localhost:5432/mydb", "dbUser", "dbPasswd", "org.postgresql.Driver") { sql ->
    sql.query('SELECT id FROM project') { rs ->
        while (rs.next()) {
            idList.add(rs.getLong(1))
        }
    }
}

See test.alipsa.groovy.datautil.SqlUtilTest for more examples!

The other thing are some complementary operations to deal with Tablesaw data, e.g. the ability to create frequency tables. See test.alipsa.groovy.datautil.TableUtilTest for usage examples!

Using the dependency

data-utils is available from maven central

Groovy:

implementation "se.alipsa.groovy:data-utils:1.0.5"

Maven:

<dependency>
    <groupId>se.alipsa.groovy</groupId>
    <artifactId>data-utils</artifactId>
    <version>1.0.5</version>
</dependency>

Version history

1.0.5, in progress

  • upgrade Tablesaw dependency overrides
  • add putAt method in GTable allowing the shorthand syntax table[0,1] = 12 and table[0, 'columnName'] = 'foo' to change data.
  • add possiblity to cast a GTable to a Grid

1.0.4, 2023.08-06

  • upgrade to jdk17
  • add conversions to/from Tablesaw and Matrix
  • add wrappers to Gtable for all Table methods returning a Table
  • move most of the Normalization code to the Matrix-stats package and adjust accordingly
  • upgrade dependencies for groovy, tablesaw, SODS, dom4j

1.0.3, 2022-12-24

  • upgrade transient dependencies with cve issues
  • upgrade to groovy 4.0.6
  • change groovy dependencies to compileOnly so that consumers of this library can use whatever compatible version of Groovy that they want without conflicts.

1.0.2, 2022-08-17

  • Add TableUtil with support for frequency tables

1.0.1, 2022-07-25

  • Upgrade to Groovy 4.0.4
  • Build script fixes

1.0.0, 2022-07-15

  • initial release

data-utils's People

Contributors

dependabot[bot] avatar pernyfelt avatar

Watchers

 avatar  avatar

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.