Git Product home page Git Product logo

Comments (4)

artur-tamazian avatar artur-tamazian commented on June 30, 2024

Looks like the AvroSchema that you pass to SchemaGenerator.generate() has no AvroFields.
Can you share the code you use to initialize it?

from avro-schema-generator.

fdjomakon avatar fdjomakon commented on June 30, 2024

Here it is, I have tried the first two code blocks you shared in the documentation but they were giving the same error :

import com.at.avro.AvroSchema;
import com.at.avro.DbSchemaExtractor;
import com.at.avro.SchemaGenerator;
import com.at.avro.config.AvroConfig;

public class GenerateAvroSchema {
    public static void main(String []args) {
        // Initialize db crawler that will create avro model objects
        DbSchemaExtractor schemaExtractor = new DbSchemaExtractor("jdbc:oracle:thin:@xxxxx:1521:SID", "user", "pass");

        AvroConfig avroConfig = new AvroConfig("com.db.raw");
        // Get avro models for a table
        AvroSchema schema = schemaExtractor.getForTable(avroConfig, "mydb_schema_name",  "mytable_name");
        System.out.println(schema.toString());
        String schemaJson = SchemaGenerator.generate(schema);
        System.out.println(schemaJson);
    }
}

I'm using ojdbc7 and have added us.fatehi:schemacrawler-oracle:14.14.02 to my maven dependencies.

from avro-schema-generator.

artur-tamazian avatar artur-tamazian commented on June 30, 2024

The code you use looks good. So we need to collect more information about what happens.

I would check the following:

  • does it work with other tables? Maybe try doing getAll() instead of getForTable() and debug/print to see if any AvroSchema has fields in it.
  • check if logs contain any suspicious warnings before the exception
  • to really see what happens you should debug and set a breakpoint around line 23 in AvroSchema. You should check what table.getColumns() returns and what happens with them later.

Without debugging or having more information it's hard to say what's wrong. Hopefully, after finding the issue we'll be able to improve the library.

from avro-schema-generator.

artur-tamazian avatar artur-tamazian commented on June 30, 2024

Closing for now. Let me know if you get more info on this.

from avro-schema-generator.

Related Issues (13)

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.