Giter Site home page Giter Site logo

Comments (12)

fils avatar fils commented on May 28, 2024 1

@pwalsh thanks for reaching out. Would love to talk to you more about this. Have a colleague also looking to expose some water column data using frictionless approaches. My data is scientific drilling cores and more geology/paleo related. Send me an email at [email protected] and lets chat about this. Would love to have a connection to Open Knowledge on this. I'm playing a role in the NSF EarthCube program too and we have a chance to advocate for data packages in that.

@danielfireman A more idiomatic approach is always going to resonate with Go users for sure. I suspect your Go Fu is more powerful than mine. :) I will attempt to better acquaint myself with idiomatic coding styles in Go and also watch your approaches with it.

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

Thanks for the feedback!

I actually thought about this collision, but I ended concluding that it won't happen in most cases (at least in simple ones). This is because tableschema-go/csv could be used in many places where encoding/csv is being used. This is particularly true for simple cases (iterating and writing CSVs).

Do you have a case in mind that you would like to share? Or a missing feature?

from tableschema-go.

fils avatar fils commented on May 28, 2024

I'll see if I can think of one... I need to start trying some code and see. I'm wondering if there might be a case where CSV needs to be modified or manipulated prior to being used in tableschema?

also

Fils:fdgolang dfils$ ls
Gopkg.lock      Gopkg.toml      main.go         vendor
Fils:fdgolang dfils$ dep status
PROJECT                                     CONSTRAINT  VERSION  REVISION  LATEST   PKGS USED
github.com/frictionlessdata/tableschema-go  ^0.1.1      v0.1.1   c105f74   c105f74  3
github.com/satori/go.uuid                   *           v1.1.0   879c588   879c588  1
Fils:fdgolang dfils$ dep ensure
Fils:fdgolang dfils$ go build
# opencoredata.org/ocdGarden/frictionlessdata/fdgolang
./main.go:16: undefined: csv.FileSource
Fils:fdgolang dfils$

I'm trying to compile the example again.. see anything obvious I am missing?

from tableschema-go.

fils avatar fils commented on May 28, 2024

@danielfireman I am playing and learning... I think the example on the README.md needs to use FromFile not FromSource and the struct needs {} and tossing in a package main makes it run directly.

package main

import "github.com/frictionlessdata/tableschema-go/csv"

// struct representing each row of the table.
type person struct {
	Name string
	Age  uint16
}

func main() {
	t, _ := csv.New(csv.FromFile("data.csv"), csv.LoadHeaders()) // load table
	t.Infer()                                                    // infer the table schema
	t.Schema.SaveToFile("schema.json")                           // save inferred schema to file
	data := []person{}
	t.CastAll(&data) // casts the table data into the data slice.
}

can't tell you have thrilled I am to have this...
I have about 18,000 datasets I want to expose this way. Was using CSV for the Web, but happy to move to Frictionless and Go is my language of choice.

You going to do the datapackage package for Go next?

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

Thanks, @fils ! Sorry for the typos in the example. My bad. Fixed in commit 3543e54

I am super glad to read your words! Thanks a lot!

Yes, datapackage is my next goal.

About t.CastAll: it is worth to check t.Iter(), which allows efficient iteration without allocating the whole dataset in memory. That example would be:

package main

import "github.com/frictionlessdata/tableschema-go/csv"

// struct representing each row of the table.
type person struct {
	Name string
	Age  uint16
}

func main() {
    t, _ := csv.New(csv.FromFile("data.csv"), csv.LoadHeaders()) // load table
    t.Infer()                                                    // infer the table schema
    t.Schema.SaveToFile("schema.json")                           // save inferred schema to file
    var p person
    iter, _ := tab.Iter()
    for iter.Next() {
        iter.CastRow(&p)
    }
}

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

Oh .. forgot to comment on the namespace collision.

I'll see if I can think of one... I need to start trying some code and see. I'm wondering if there might be a case where CSV needs to be modified or manipulated prior to being used in tableschema?

That's a great point! My plan is to cover this the full need using tableschema-go. The writing needs are going to be fixed by #31 . Your considerations also allowed me to reconsider the Table API. I would say we should go with a more idiomatic approach for go: Readers and Writers.

What do you think?

from tableschema-go.

pwalsh avatar pwalsh commented on May 28, 2024

Hi @fils . I'm the Product Owner on the Frictionless Data work we do at Open Knowledge International. I'd love to hear more about your 18,000 datasets, so I can potentially learn about new use cases and applications for the specs and tooling.

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

@fils Sure! I'll be rolling out those changes over this week and release a new version by Friday. I would like to start working on datapackages-go next week.

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

All the reading path is done. Closing this issue and following up with the writing path on issue #31

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

@fils Just released a new version with some API changes for reading (more idiomatic) and also adding writing capabilities.

Improved a lot the README.md

Please let me know if you have any problems or have suggestions.

Thanks!

from tableschema-go.

fils avatar fils commented on May 28, 2024

@danielfireman I'll pull down updates tomorrow and do some tests with reading and writing some example datasets with some of my own data. I'll link in my examples and experiences here.

from tableschema-go.

danielfireman avatar danielfireman commented on May 28, 2024

from tableschema-go.

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.