FAQ
Hi,

I'm trying to use a JDBCTap to write to a MySQL db and i'm getting an error
I can't seem to get around, nor really understand (2nd day of using
cascalog).

A gist of the code is here: https://gist.github.com/3047824 and the error
I'm getting is *[JDBCScheme[['id',
'scr...][sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)] unable to resolve scheme sink selector: [{1}:'id'], with incoming:
[{1}:'?id']* which to me looks like it can't match up the database columns
I've supplied with what's getting output by the generator, but I don't know
how to fix it nor where to go next with it so I'm hoping someone can point
me in the right direction!

Thanks

Search Discussions

  • Mr Jaba at Jul 5, 2012 at 8:31 am
    I thought I'd also just update this post with a stack trace. I'm running it
    in Emacs via swank:

    Tap.java:310 cascading.tap.Tap.outgoingScopeFor
    ElementGraph.java:589 cascading.flow.planner.ElementGraph.resolveFields
    ElementGraph.java:571 cascading.flow.planner.ElementGraph.resolveFields
    HadoopPlanner.java:215 cascading.flow.hadoop.planner.HadoopPlanner.buildFlow
    FlowConnector.java:454 cascading.flow.FlowConnector.connect
    api.clj:190 cascalog.api/compile-flow
    RestFn.java:137 clojure.lang.RestFn.applyTo
    core.clj:601 clojure.core/apply
    api.clj:204 cascalog.api/?-
    RestFn.java:436 clojure.lang.RestFn.invoke
    NO_SOURCE_FILE:1 paduka.db-tap/eval2418
    Compiler.java:6511 clojure.lang.Compiler.eval
    Compiler.java:6477 clojure.lang.Compiler.eval
    core.clj:2797 clojure.core/eval
    core.clj:532 swank.core/eval786[fn]
    MultiFn.java:163 clojure.lang.MultiFn.invoke
    basic.clj:54 swank.commands.basic/eval-region
    basic.clj:44 swank.commands.basic/eval-region
    basic.clj:73 swank.commands.basic/eval974[fn]
    Var.java:415 clojure.lang.Var.invoke
    (Unknown Source) paduka.db-tap/eval2416
    Compiler.java:6511 clojure.lang.Compiler.eval
    Compiler.java:6477 clojure.lang.Compiler.eval
    core.clj:2797 clojure.core/eval
    core.clj:100 swank.core/eval-in-emacs-package
    core.clj:256 swank.core/eval-for-emacs
    Var.java:423 clojure.lang.Var.invoke
    AFn.java:167 clojure.lang.AFn.applyToHelper
    Var.java:532 clojure.lang.Var.applyTo
    core.clj:601 clojure.core/apply
    core.clj:107 swank.core/eval-from-control
    core.clj:330 swank.core/spawn-worker-thread[fn]
    AFn.java:159 clojure.lang.AFn.applyToHelper
    AFn.java:151 clojure.lang.AFn.applyTo
    core.clj:601 clojure.core/apply
    core.clj:326 swank.core/spawn-worker-thread[fn]
    RestFn.java:397 clojure.lang.RestFn.invoke
    AFn.java:24 clojure.lang.AFn.run
    Thread.java:662 java.lang.Thread.run
    On Wednesday, 4 July 2012 16:46:04 UTC+1, Mr Jaba wrote:

    Hi,

    I'm trying to use a JDBCTap to write to a MySQL db and i'm getting an
    error I can't seem to get around, nor really understand (2nd day of using
    cascalog).

    A gist of the code is here: https://gist.github.com/3047824 and the error
    I'm getting is *[JDBCScheme[['id',
    'scr...][sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)] unable to resolve scheme sink selector: [{1}:'id'], with incoming:
    [{1}:'?id']* which to me looks like it can't match up the database
    columns I've supplied with what's getting output by the generator, but I
    don't know how to fix it nor where to go next with it so I'm hoping someone
    can point me in the right direction!

    Thanks

  • Paul Lam at Jul 5, 2012 at 9:51 am
    A few things.

    1) your output is only "?id" field.
    2) the fields name need to have question mark in front, whereas the SQL
    column name must not. Otherwise the tap couldn't find the fields or SQL
    complains, respectively.
    3) you need to define your table in a SQL sink.

    Try this:

    (defn mysql-tap [] (let [scheme (JDBCScheme. (Fields. (into-array String
    ["?id"])) (into-array String ["id"]))
    table-desc (TableDesc. "tweets" (into-array String ["?id"])
    (into-array String ["id"]) (into-array String []))
    tap (JDBCTap.
    "jdbc:mysql://localhost:3306/burn?user=root&password="
    "com.mysql.jdbc.Driver" table-desc scheme )]
    tap))

    On Thursday, 5 July 2012 09:31:22 UTC+1, Mr Jaba wrote:

    I thought I'd also just update this post with a stack trace. I'm running
    it in Emacs via swank:

    Tap.java:310 cascading.tap.Tap.outgoingScopeFor
    ElementGraph.java:589 cascading.flow.planner.ElementGraph.resolveFields
    ElementGraph.java:571 cascading.flow.planner.ElementGraph.resolveFields
    HadoopPlanner.java:215
    cascading.flow.hadoop.planner.HadoopPlanner.buildFlow
    FlowConnector.java:454 cascading.flow.FlowConnector.connect
    api.clj:190 cascalog.api/compile-flow
    RestFn.java:137 clojure.lang.RestFn.applyTo
    core.clj:601 clojure.core/apply
    api.clj:204 cascalog.api/?-
    RestFn.java:436 clojure.lang.RestFn.invoke
    NO_SOURCE_FILE:1 paduka.db-tap/eval2418
    Compiler.java:6511 clojure.lang.Compiler.eval
    Compiler.java:6477 clojure.lang.Compiler.eval
    core.clj:2797 clojure.core/eval
    core.clj:532 swank.core/eval786[fn]
    MultiFn.java:163 clojure.lang.MultiFn.invoke
    basic.clj:54 swank.commands.basic/eval-region
    basic.clj:44 swank.commands.basic/eval-region
    basic.clj:73 swank.commands.basic/eval974[fn]
    Var.java:415 clojure.lang.Var.invoke
    (Unknown Source) paduka.db-tap/eval2416
    Compiler.java:6511 clojure.lang.Compiler.eval
    Compiler.java:6477 clojure.lang.Compiler.eval
    core.clj:2797 clojure.core/eval
    core.clj:100 swank.core/eval-in-emacs-package
    core.clj:256 swank.core/eval-for-emacs
    Var.java:423 clojure.lang.Var.invoke
    AFn.java:167 clojure.lang.AFn.applyToHelper
    Var.java:532 clojure.lang.Var.applyTo
    core.clj:601 clojure.core/apply
    core.clj:107 swank.core/eval-from-control
    core.clj:330 swank.core/spawn-worker-thread[fn]
    AFn.java:159 clojure.lang.AFn.applyToHelper
    AFn.java:151 clojure.lang.AFn.applyTo
    core.clj:601 clojure.core/apply
    core.clj:326 swank.core/spawn-worker-thread[fn]
    RestFn.java:397 clojure.lang.RestFn.invoke
    AFn.java:24 clojure.lang.AFn.run
    Thread.java:662 java.lang.Thread.run
    On Wednesday, 4 July 2012 16:46:04 UTC+1, Mr Jaba wrote:

    Hi,

    I'm trying to use a JDBCTap to write to a MySQL db and i'm getting an
    error I can't seem to get around, nor really understand (2nd day of using
    cascalog).

    A gist of the code is here: https://gist.github.com/3047824 and the
    error I'm getting is *[JDBCScheme[['id',
    'scr...][sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)] unable to resolve scheme sink selector: [{1}:'id'], with incoming:
    [{1}:'?id']* which to me looks like it can't match up the database
    columns I've supplied with what's getting output by the generator, but I
    don't know how to fix it nor where to go next with it so I'm hoping someone
    can point me in the right direction!

    Thanks

  • Mr Jaba at Jul 5, 2012 at 10:04 am
    Hi Paul,

    Thank you so much for your help! that's fixed it and it's now happily
    inserting into MySQL.

    Kind Regards

    Tom
    On Thursday, 5 July 2012 10:51:14 UTC+1, Paul Lam wrote:

    A few things.

    1) your output is only "?id" field.
    2) the fields name need to have question mark in front, whereas the SQL
    column name must not. Otherwise the tap couldn't find the fields or SQL
    complains, respectively.
    3) you need to define your table in a SQL sink.

    Try this:

    (defn mysql-tap [] (let [scheme (JDBCScheme. (Fields. (into-array String
    ["?id"])) (into-array String ["id"]))
    table-desc (TableDesc. "tweets" (into-array String ["?id"])
    (into-array String ["id"]) (into-array String []))
    tap (JDBCTap.
    "jdbc:mysql://localhost:3306/burn?user=root&password="
    "com.mysql.jdbc.Driver" table-desc scheme )]
    tap))

    On Thursday, 5 July 2012 09:31:22 UTC+1, Mr Jaba wrote:

    I thought I'd also just update this post with a stack trace. I'm running
    it in Emacs via swank:

    Tap.java:310 cascading.tap.Tap.outgoingScopeFor
    ElementGraph.java:589 cascading.flow.planner.ElementGraph.resolveFields
    ElementGraph.java:571 cascading.flow.planner.ElementGraph.resolveFields
    HadoopPlanner.java:215
    cascading.flow.hadoop.planner.HadoopPlanner.buildFlow
    FlowConnector.java:454 cascading.flow.FlowConnector.connect
    api.clj:190 cascalog.api/compile-flow
    RestFn.java:137 clojure.lang.RestFn.applyTo
    core.clj:601 clojure.core/apply
    api.clj:204 cascalog.api/?-
    RestFn.java:436 clojure.lang.RestFn.invoke
    NO_SOURCE_FILE:1 paduka.db-tap/eval2418
    Compiler.java:6511 clojure.lang.Compiler.eval
    Compiler.java:6477 clojure.lang.Compiler.eval
    core.clj:2797 clojure.core/eval
    core.clj:532 swank.core/eval786[fn]
    MultiFn.java:163 clojure.lang.MultiFn.invoke
    basic.clj:54 swank.commands.basic/eval-region
    basic.clj:44 swank.commands.basic/eval-region
    basic.clj:73 swank.commands.basic/eval974[fn]
    Var.java:415 clojure.lang.Var.invoke
    (Unknown Source) paduka.db-tap/eval2416
    Compiler.java:6511 clojure.lang.Compiler.eval
    Compiler.java:6477 clojure.lang.Compiler.eval
    core.clj:2797 clojure.core/eval
    core.clj:100 swank.core/eval-in-emacs-package
    core.clj:256 swank.core/eval-for-emacs
    Var.java:423 clojure.lang.Var.invoke
    AFn.java:167 clojure.lang.AFn.applyToHelper
    Var.java:532 clojure.lang.Var.applyTo
    core.clj:601 clojure.core/apply
    core.clj:107 swank.core/eval-from-control
    core.clj:330 swank.core/spawn-worker-thread[fn]
    AFn.java:159 clojure.lang.AFn.applyToHelper
    AFn.java:151 clojure.lang.AFn.applyTo
    core.clj:601 clojure.core/apply
    core.clj:326 swank.core/spawn-worker-thread[fn]
    RestFn.java:397 clojure.lang.RestFn.invoke
    AFn.java:24 clojure.lang.AFn.run
    Thread.java:662 java.lang.Thread.run
    On Wednesday, 4 July 2012 16:46:04 UTC+1, Mr Jaba wrote:

    Hi,

    I'm trying to use a JDBCTap to write to a MySQL db and i'm getting an
    error I can't seem to get around, nor really understand (2nd day of using
    cascalog).

    A gist of the code is here: https://gist.github.com/3047824 and the
    error I'm getting is *[JDBCScheme[['id',
    'scr...][sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)] unable to resolve scheme sink selector: [{1}:'id'], with incoming:
    [{1}:'?id']* which to me looks like it can't match up the database
    columns I've supplied with what's getting output by the generator, but I
    don't know how to fix it nor where to go next with it so I'm hoping someone
    can point me in the right direction!

    Thanks

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcascalog-user @
categoriesclojure, hadoop
postedJul 4, '12 at 6:33p
activeJul 5, '12 at 10:04a
posts4
users2
websiteclojure.org
irc#clojure

2 users in discussion

Mr Jaba: 3 posts Paul Lam: 1 post

People

Translate

site design / logo © 2022 Grokbase