Giter Site home page Giter Site logo

Comments (9)

pacman82 avatar pacman82 commented on August 29, 2024

The Rust crate allows passing an arrow Schema in case the application developer has insight which is not reflected in the Schema. Arrow does have Date type, doesn't it?

from arrow-odbc-py.

jonashaag avatar jonashaag commented on August 29, 2024

I'd be more interested in having something done automatically, since I'm writing generic/library code.

from arrow-odbc-py.

pacman82 avatar pacman82 commented on August 29, 2024

It already works automatically if the type reported by the driver is SQL_TYPE_DATE. If the schema information is not okay, or the driver has problems relaying it precisely input from the application developer is needed.

from arrow-odbc-py.

pacman82 avatar pacman82 commented on August 29, 2024

I'd be more interested in having something done automatically, since I'm writing generic/library code.

I think I need to better understand what you mean by this. Would a function be helpful which returns the automatically deduced arrow schema?

You could then apply generic logic to that schema to your hearts content. Together with the ability to feed it back into the creation of the reader.

from arrow-odbc-py.

pacman82 avatar pacman82 commented on August 29, 2024

Alternatively? How do you think about a function you can pass which manipulates the schema?

What I currently rule out are any decisions based on the values of the fields in the table themselves. This would really mess with the stream based nature of the package. Still applications can feel free to restart the stream based on what they see.

from arrow-odbc-py.

jonashaag avatar jonashaag commented on August 29, 2024

Yea, that would work well! If there's a way to pass the first batch of data to the callback that might be even more general purpose, although I don't know what representation could be used for the data in that case, outside of all-strings.

Just a note: I'm not aware of any other library that uses a callback to modify the schema. Usually you can only pass the final schema directly, without the callback. It probably still is the better design for arrow-odbc-py!

from arrow-odbc-py.

jonashaag avatar jonashaag commented on August 29, 2024

Btw, I'm also fine fully solving this problem on my end by dynamically getting the schema and adding casts to the query.

from arrow-odbc-py.

pacman82 avatar pacman82 commented on August 29, 2024

arrow-odbc 2.1.0 has been released. It allows for specifying a schema parameter in order to overwrite the desired target arrow schema. In theory a generic application could already be written on top of that. One could instantiate the reader twice the first time to generate obtain the schema and the second time to with the manipulated and the actually desired target schema. However of course this involves an extra roundtrip to the database and is wasteful.

If I would go the second step, I would probably provide a function to just create the cursor. The user can than inspect and manipulate the schema. With a second function call the cursor would then be turned into the reader.

from arrow-odbc-py.

jonashaag avatar jonashaag commented on August 29, 2024

Thank you! For now, I consider this fixed (assuming it works, which I'll try out soon)

from arrow-odbc-py.

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.