RJMetrics / sweet-liberty

A library for building database-backed RESTful services using Clojure
Apache License 2.0
104 stars 6 forks source link

How to debug SQL based errors? #2

Closed ryanmmmmm closed 9 years ago

ryanmmmmm commented 9 years ago

I have put together a simple service and I am getting this error:

How do i Debug this SQL error to figure out what is going on?

{ "exception-message": "ERROR: syntax error at or near \")\"\n Position: 23", "stack-trace": [ "org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)", "org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)", "org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)", "org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)", "org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)", "org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)", "clojure.java.jdbc$db_do_prepared_return_keys$exec_and_return_keys1410.invoke(jdbc.clj:692)", "clojure.java.jdbc$db_do_prepared_return_keys.invoke(jdbc.clj:707)", "clojure.java.jdbc$multi_insert_helper$fn1463.invoke(jdbc.clj:897)", "clojure.core$map$fn__4245.invoke(core.clj:2559)", "clojure.lang.LazySeq.sval(LazySeq.java:40)", "clojure.lang.LazySeq.seq(LazySeq.java:49)", "clojure.lang.RT.seq(RT.java:484)", "clojure.core$seq.invoke(core.clj:133)",

bpiel commented 9 years ago

@ryanmedlin I would start by enabling logging and checking the output. Sweet lib has log4j support and will log sql queries right before it attempts to execute them. It will also log the results. It logs these at the log4j DEBUG level.

The README has a very brief write up and example here: https://github.com/RJMetrics/sweet-liberty/blob/master/README.md#logging-with-log4j

I would set the following in the log4j.properties, instead of the first line in the README: log4j.rootLogger=TRACE That sets a low logging threshold and should ensure that you get the output you need.

Let me know if that gets you anywhere. I'll get back here with more details when I can.

ryanmmmmm commented 9 years ago

yeah that what im checking now i thought i had done that but I do not see these logs:

(log/debug (json/write-str (assoc mdc :message "Inserting a row" :table (:table-name table) :row row-map :query-result result)))

ryanmmmmm commented 9 years ago

her is the current output..I;m not seeing the "interting a row" dont worry those auth credentials are in our test environment..

,"wjyM7gjZxxpR58hmWYf1G","1lrRqdfdB481lz12W2eI7T"]},"request-method":":post"}} DEBUG com.rjmetrics.sweet-liberty.db: {"raw-query":["SELECT _id, identifier, name, organization_id, temperature, vendor_identifier FROM beacon WHERE _id IS NULL"]} DEBUG com.rjmetrics.sweet-liberty.db: {"query-result":[],"raw-query":["SELECT _id, identifier, name, organization_id, temperature, vendor_identifier FROM beacon WHERE id IS NULL"]} DEBUG com.rjmetrics.sweet-liberty.handlers: {"request":{"authenticated":"true","ssl-client-cert":null,"remote-addr":"0:0:0:0:0:0:0:1","request-groups":["3HRhnUtmtXnT1UHQHClAcP"],"params":{},"servlet-context":"ServletContext@o.e.j.s.ServletContextHandler{\/,null}","servlet-response":"HTTP\/1.1 200 \n\r\n","servlet":"ring.util.servlet.proxy$javax.servlet.http.HttpServlet$ff19274a@227f0906","route-params":{},"headers":{"user-agent":"curl\/7.37.1","content-type":"application\/json","content-length":"539","authorization":"Basic MUVNNTNIVDg1OTdDQzdRNVFQMFU4RE43MzpDY2R1eWFrUnNaOEFRL0hMZFhFUjJFanNDT2xmMjlDVEZWay9CY3RGbVFN","accept":"\/_","host":"localhost:8082"},"server-port":8082,"servlet-request":"(POST \/v1.0\/beacon)@1110014619 org.eclipse.jetty.server.Request@42297a9b","request-body":{"vendor":"QWERTY","is_mobile":"true","ble_vendor_uuid":"qwer-12340op","organization_id":"3HRhnUtmtXnT1UHQHClAcP","vendor_identifier":"QWAS12QW","name":"Beacon12345","ble_vendor_id":"123ert67hRF","hardware":"aszxdcerty","longitude":"56.1","antenna_type":"zawedc","major":"12","mac_address":"12:QW:34:12:12","ble_uuid":"1234-qwerqw-1231-123","identifier":"OkapiBeacon123PostTest","latitude":"40.3","minor":"45","uuid":"qwer1234wqer","battery_level":"123","visibility":"true","temperature":"80.5"},"content-length":539,"form-params":{},"status":200,"query-params":{},"content-type":"application\/json","path-info":"\/beacon","character-encoding":null,"context":"\/v1.0","uri":"\/v1.0\/beacon","server-name":"localhost","query-string":null,"body":"org.eclipse.jetty.server.HttpInput@3130780c","scheme":":http","user-groups-permissions":{"permissions":"{PlayStudios_myVegasSlots_Belagio=[Dashboard Read]}","groups":["76l5DP3pfaw76qYhtC661Q","1Fsn8wBh5ybXIW5cJOszLZ","2MSAdqzcHqvqVdEM8vOLnS","76ZjO4bAer3giCM1so7g61","1SIGlb86IZ5Q4nHDVfCAYg","dUvMEKXPFMbmovnh24LS9","3o6XRrl1a9diFkJbTd2CSb","3HRhnUtmtXnT1UHQHClAcP","119UQWGg6qKC7Lle4Et5Gi","1POtqdjZl367yWdBWboE3L","7OpWTfozbyl8ZoaBJ1OClC","3ZRgyxvDMwKmoOZIEJtrw5","1I3159poZuMrswMYjcefKX","6owQwEXmO54fIg73izpQfH","6Id885IGtsFyV13r4hQjOs","2iVHZMgQaz5J9P2QVPVXyB","4Bqa6YFSWDhgOiwofsGDD3","4Sx66qFT3n0tWgxx4VGILF","70P06jyLa6lqRNHUre0t7l","DS6MzNORa7yOPic0jWwxR","f8nCwVHZNuoEJ07op3RRK","wjyM7gjZxxpR58hmWYf1G","1lrRqdfdB481lz12W2eI7T"]},"request-method":":post"}} ERROR com.rjmetrics.sweet-liberty.core: {"exception-message":"ERROR: syntax error at or near \")\"\n Position: 23","stack-trace":["org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)","org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)","org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)","org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)","org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)","org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)","clojure.java.jdbc$db_do_prepared_return_keys$exec_and_return_keys__1410.invoke(

ryanmmmmm commented 9 years ago

{ "exception-message": "ERROR: syntax error at or near \")\"\n Position: 23", "stack-trace": [ "org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)", "org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)", "org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)", "org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)", "org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)", "org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)", "clojure.java.jdbc$db_do_prepared_return_keys$exec_and_return_keys1410.invoke(jdbc.clj:692)", "clojure.java.jdbc$db_do_prepared_return_keys.invoke(jdbc.clj:707)", "clojure.java.jdbc$multi_insert_helper$fn1463.invoke(jdbc.clj:897)", "clojure.core$map$fn4245.invoke(core.clj:2559)", "clojure.lang.LazySeq.sval(LazySeq.java:40)", "clojure.lang.LazySeq.seq(LazySeq.java:49)", "clojure.lang.RT.seq(RT.java:484)", "clojure.core$seq.invoke(core.clj:133)", "clojure.core$dorun.invoke(core.clj:2855)", "clojure.core$doall.invoke(core.clj:2871)", "clojure.java.jdbc$multi_insert_helper.invoke(jdbc.clj:896)", "clojure.java.jdbc$insert_helper$fn1466.invoke(jdbc.clj:907)", "clojure.java.jdbc$db_transactionSTAR.doInvoke(jdbc.clj:580)", "clojure.lang.RestFn.invoke(RestFn.java:425)", "clojure.java.jdbc$insert_helper.invoke(jdbc.clj:907)", "clojure.java.jdbc$insertBANG.doInvoke(jdbc.clj:999)", "clojure.lang.RestFn.invoke(RestFn.java:442)", "com.rjmetrics.sweet_liberty.db$insert_entity_into_storage.invoke(db.clj:64)", "com.rjmetrics.sweet_liberty.handlers$make_create_entity_fn$fn2434$fn__2437.invoke(handlers.clj:148)", "com.rjmetrics.sweet_liberty.handlers$run_with_conditions.invoke(handlers.clj:39)", "com.rjmetrics.sweet_liberty.handlers$make_create_entity_fn$fn2434.invoke(handlers.clj:145)", "liberator.core$decide.invoke(core.clj:98)", "liberator.core$postBANG.invoke(core.clj:264)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$can_post_to_missingQMARK.invoke(core.clj:266)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$post_to_missingQMARK.invoke(core.clj:268)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$existedQMARK.invoke(core.clj:285)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$method_putQMARK.invoke(core.clj:301)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$if_match_star_exists_for_missingQMARK.invoke(core.clj:305)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$existsQMARK.invoke(core.clj:406)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$processableQMARK.invoke(core.clj:409)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$accept_encoding_existsQMARK.invoke(core.clj:428)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$accept_charset_existsQMARK.invoke(core.clj:441)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$accept_language_existsQMARK.invoke(core.clj:455)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$media_type_availableQMARK.invoke(core.clj:465)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$accept_existsQMARK.invoke(core.clj:468)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$is_optionsQMARK.invoke(core.clj:485)", "liberator.core$decide.invoke(core.clj:103)", "liberator.core$valid_entity_lengthQMARK.invoke(core.clj:488)",

bpiel commented 9 years ago

@ryanmedlin I see. Looks like we forgot to log the insert statement before execution. Looks like we got it right in the other cases though. That's why you're not getting the statement in the logs. If you want to submit a PR, that'd be awesome. Otherwise, I'll take care of it myself tonight or tomorrow morning (EST).

ryanmmmmm commented 9 years ago

yeah one step ahead of you..will submit in a bit

for some reason I'm not getting data passed in am tracing my code now:

DEBUG com.rjmetrics.sweet-liberty.db: {"row":{},"data":{},"table":"beacon","message":"Inserting a row"}

ryanmmmmm commented 9 years ago

curl -X POST "http://localhost:8082/v1.0/beacon" -H "Authorization: Basic MUVNNTNIVDg1OTdDQzdRNVFQMFU4RE43MzpDY2R1eWFrUnNaOEFRL0hMZFhFUjJFanNDT2xmMjlDVEZWay9CY3RGbVFN" -H "Content-type: application/json" -d $' {\n "identifier": "OkapiBeacon123PostTest", "name": "Beacon12345", "organization_id": "3HRhnUtmtXnT1UHQHClAcP", "temperature": "80.5", "vendor_identifier": "QWAS12QW", "vendor": "QWERTY", "ble_uuid": "1234-qwerqw-1231-123", "ble_vendor_uuid": "qwer-12340op", "ble_vendor_id": "123ert67hRF", "uuid": "qwer1234wqer", "major": "12", "minor": "45", "antenna_type": "zawedc", "mac_address": "12:QW:34:12:12", "is_mobile": "true", "latitude": "40.3", "longitude": "56.1", "visibility": "true", "battery_level": "123", "hardware": "aszxdcerty" \n}' -m 30 -v

ryanmmmmm commented 9 years ago

here is the request: why woudl the data get dropped on the floor?

DEBUG com.rjmetrics.sweet-liberty.db: {"query-result":[],"raw-query":["SELECT _id, identifier, name, organization_id, temperature, vendor_identifier FROM beacon WHERE id IS NULL"]} DEBUG com.rjmetrics.sweet-liberty.handlers: {"request":{"authenticated":"true","ssl-client-cert":null,"remote-addr":"0:0:0:0:0:0:0:1","request-groups":["3HRhnUtmtXnT1UHQHClAcP"],"params":{},"servlet-context":"ServletContext@o.e.j.s.ServletContextHandler{\/,null}","servlet-response":"HTTP\/1.1 200 \n\r\n","servlet":"ring.util.servlet.proxy$javax.servlet.http.HttpServlet$ff19274a@6c07ef17","route-params":{},"headers":{"user-agent":"curl\/7.37.1","content-type":"application\/json","content-length":"539","authorization":"Basic MUVNNTNIVDg1OTdDQzdRNVFQMFU4RE43MzpDY2R1eWFrUnNaOEFRL0hMZFhFUjJFanNDT2xmMjlDVEZWay9CY3RGbVFN","accept":"\/_","host":"localhost:8082"},"server-port":8082,"servlet-request":"(POST \/v1.0\/beacon)@2095187561 org.eclipse.jetty.server.Request@7ce20669","request-body":{"vendor":"QWERTY","is_mobile":"true","ble_vendor_uuid":"qwer-12340op","organization_id":"3HRhnUtmtXnT1UHQHClAcP","vendor_identifier":"QWAS12QW","name":"Beacon12345","ble_vendor_id":"123ert67hRF","hardware":"aszxdcerty","longitude":"56.1","antenna_type":"zawedc","major":"12","mac_address":"12:QW:34:12:12","ble_uuid":"1234-qwerqw-1231-123","identifier":"OkapiBeacon123PostTest","latitude":"40.3","minor":"45","uuid":"qwer1234wqer","battery_level":"123","visibility":"true","temperature":"80.5"},"content-length":539,"form-params":{},"status":200,"query-params":{},"content-type":"application\/json","path-info":"\/beacon","character-encoding":null,"context":"\/v1.0","uri":"\/v1.0\/beacon","server-name":"localhost","query-string":null,"body":"org.eclipse.jetty.server.HttpInput@5b13178c","scheme":":http","user-groups-permissions":{"permissions":"{PlayStudios_myVegasSlots_Belagio=[Dashboard Read]}","groups":["76l5DP3pfaw76qYhtC661Q","1Fsn8wBh5ybXIW5cJOszLZ","2MSAdqzcHqvqVdEM8vOLnS","76ZjO4bAer3giCM1so7g61","1SIGlb86IZ5Q4nHDVfCAYg","dUvMEKXPFMbmovnh24LS9","3o6XRrl1a9diFkJbTd2CSb","3HRhnUtmtXnT1UHQHClAcP","119UQWGg6qKC7Lle4Et5Gi","1POtqdjZl367yWdBWboE3L","7OpWTfozbyl8ZoaBJ1OClC","3ZRgyxvDMwKmoOZIEJtrw5","1I3159poZuMrswMYjcefKX","6owQwEXmO54fIg73izpQfH","6Id885IGtsFyV13r4hQjOs","2iVHZMgQaz5J9P2QVPVXyB","4Bqa6YFSWDhgOiwofsGDD3","4Sx66qFT3n0tWgxx4VGILF","70P06jyLa6lqRNHUre0t7l","DS6MzNORa7yOPic0jWwxR","f8nCwVHZNuoEJ07op3RRK","wjyM7gjZxxpR58hmWYf1G","1lrRqdfdB481lz12W2eI7T"]},"request-method":":post"}}

ryanmmmmm commented 9 years ago

GET is working ok:

curl -X GET "http://localhost:8082/v1.0/beacon?organization_ids=3HRhnUtmtXnT1UHQHClAcP" -H "Authorization: Basic MUVNNTNIVDg1OTdDQzdRNVFQMFU4RE43MzpDY2R1eWFrUnNaOEFRL0hMZFhFUjJFanNDT2xmMjlDVEZWay9CY3RGbVFN" \ -m 30 -v

[{"name":"Datasnap - Front Door","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"KWAW-18BEH"},{"name":"Datasnap - Kitchen","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"YUA5-7JWW9"},{"name":"Datasnap - Small Office","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"TUCT-8EA7H"},{"name":"Datasnap - Stairs Entrance","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"RN4T-K8WWG"},{"name":"Datasnap - Test Beacon 1","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"GFYY-AEANK"},{"name":"Datasnap - WIndow","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"NZ16-APBA2"},{"name":"Front Entrance","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"SHDG-28AHD"},{"name":"Initial 3 - MZRW3","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"WFBZ-MZRW3"},{"name":"Kates Mobile Beacon","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"XZJY-EVVYx"},{"name":"Ryan Locator","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"YTXC-AAFNF"},{"name":"UBPQ-Z42X2","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"UBPQ-Z42X2"},{"name":"disrupt","organization_id":"3HRhnUtmtXnT1UHQHClAcP","identifier":"5ZY6-P7VRC"}]%

bpiel commented 9 years ago

Yeah, at first I was wondering if there could just be a problem with your config, but I saw that the select statements looked ok in the logs you had posted before. I'm eyeballing the pipeline to see if I can spot anything that could be a gotcha. One thing I'm considering is that we've never used this with postgres (anything besides mysql actually) before. We're relying on jdbc and honeysql to handle those differences so, it shouldn't make a difference, but...

ryanmmmmm commented 9 years ago

Do you see anything in the debug request that would be the reason why there is no dat/row being passed into the insert function? i think its just that the :data :row data is not being passed in and a bad SQL statement is generated since there really isnt any error checking.

i see you require wrap params and we have that in our routes but ill look into why that data isnt getting passed in if you dont see anything offhand.

ryanmmmmm commented 9 years ago

ill go ahead and submit pull request for that logging:

https://github.com/RJMetrics/sweet-liberty/pull/3

ryanmmmmm commented 9 years ago

i figured it out.. we are using some middleware auth that was mucking around and not setitng the params in the way your library is expecting, one i fixed the json posted to have :body-params it started working and now im on to debugging my code furthur..thanks!

ryanmmmmm commented 9 years ago

this is the new error i get, not much useful info there in this exception so i am debugging this now:

EBUG com.rjmetrics.sweet-liberty.db: {"query-result":[null],"row":{"vendor_identifier":"QWAS12QW","temperature":80.5,"organization_id":"3HRhnUtmtXnT1UHQHClAcP","name":"Beacon12345","identifier":"OkapiBeacon123PostTest"},"table":"beacon","message":"Successfully inserted a row"} ERROR com.rjmetrics.sweet-liberty.core: {"exception-message":null,"stack-trace":["clojure.core$val.invoke(core.clj:1502)","com.rjmetrics.sweet_liberty.db$insert_entity_into_storage.invoke(db.clj:77)","com.rjmetrics.sweet_liberty.handlers$make_create_entity_fn$fn2435$fn2438.invoke(handlers.clj:148)","com.rjmetrics.sweet_liberty.handlers$run_with_conditions.invoke(handlers.clj:39)","com.rjmetrics.sweet_liberty.handlers$make_create_entity_fn$fn2435.invoke(handlers.clj:145)","liberator.core$decide.invoke(core.clj:98)","liberator.core$postBANG.invoke(core.clj:264)","liberator.core$decide.invoke(core.clj:103)","liberator.core$can_post_to_missingQMARK.invoke(core.clj:266)","liberator.core$decide.invoke(core.clj:103)","liberator.core$post_to_missingQMARK.invoke(core.clj:268)","liberator.core$decide.invoke(core.clj:103)","liberator.core$existedQMARK.invoke(core.clj:285)","liberator.core$decide.invoke(core.clj:103)","liberator.core$method_putQMARK.invoke(core.clj:301)","liberator.core$decide.invoke(core.clj:103)","liberator.core$if_match_star_exists_for_missingQMARK.invoke(core.clj:305)","liberator.core$decide.invoke(core.clj:103)","liberator.core$existsQMARK.invoke(core.clj:406)","liberator.core$decide.invoke(core.clj:103)","liberator.core$processableQMARK.invoke(core.clj:409)","liberator.core$decide.invoke(core.clj:103)","liberator.core$accept_encoding_existsQMARK.invoke(core.clj:428)","liberator.core$decide.invoke(core.clj:103)","liberator.core$accept_charset_existsQMARK.invoke(core.clj:441)","liberator.core$decide.invoke(core.clj:103)","liberator.core$accept_language_existsQMARK.invoke(core.clj:455)","liberator.core$decide.invoke(core.clj:103)","liberator.core$media_type_availableQMARK.invoke(core.clj:465)","liberator.core$decide.invoke(core.clj:103)","liberator.core$accept_existsQMARK.invoke(core.clj:468)","liberator.core$decide.invoke(core.clj:103)","liberator.core$is_optionsQMARK.invoke(core.clj:485)","liberator.core$decide.invoke(core.clj:103)","liberator.core$valid_entity_lengthQMARK.invoke(core.clj:488)","liberator.core$decide.invoke(core.clj:103)","liberator.core$known_content_typeQMARK.invoke(core.clj:491)","liberator.core$decide.invoke(core.clj:103)","liberator.core$valid_content_headerQMARK.invoke(core.clj:493)","liberator.core$decide.invoke(core.clj:103)","liberator.core$allowedQMARK.invoke(core.clj:496)","liberator.core$decide.invoke(core.clj:103)","liberator.core$authorizedQMARK.invoke(core.clj:499)","liberator.core$decide.invoke(core.clj:103)","liberator.core$malformedQMARK.invoke(core.clj:502)","liberator.core$decide.invoke(core.clj:103)","liberator.core$method_allowedQMARK.invoke(core.clj:505)","liberator.core$decide.invoke(core.clj:103)","liberator.core$uri_too_longQMARK.invoke(core.clj:508)","liberator.core$decide.invoke(core.clj:103)","liberator.core$known_methodQMARK.invoke(core.clj:511)","liberator.core$decide.invoke(core.clj:103)","liberator.core$service_availableQMARK.invoke(core.clj:514)","liberator.core$run_resource.invoke(core.clj:598)","liberator.core$resource$fn3765.invoke(core.clj:616)","compojure.response$fn958.invoke(response.clj:32)","compojure.response$fn935$G930__942.invoke(response.clj:9)","compojure.core$make_route$fn1165.invoke(core.clj:99)","compojure.core$if_route$fn1153.invoke(core.clj:45)","compojure.core$if_method$fn1146.invoke(core.clj:30)","compojure.core$routing$fn1171.invoke(core.clj:112)","clojure.core$some.invoke(core.clj:2515)","compojure.core$routing.doInvoke(core.clj:112)","clojure.lang.RestFn.invoke(RestFn.java:2442)","okapi.handler$fn__9409.invoke(handler.clj:300)","compojure.core$wrap_context$fn1190.invoke(core.clj:176)","compojure.core$if_route$fn1153.invoke(core.clj:45)","compojure.core$routing$fn1171.invoke(core.clj:112)","clojure.core$some.invoke(core.clj:2515)","compojure.core$routing.doInvoke(core.clj:112)","clojure.lang.RestFn.applyTo(RestFn.java:139)","clojure.core$apply.invoke(core.clj:626)","compojure.core$routes$fn1175.invoke(core.clj:117)","compojure.core$routing$fn1171.invoke(core.clj:112)","clojure.core$some.invoke(core.clj:2515)","compojure.core$routing.doInvoke(core.clj:112)","clojure.lang.RestFn.applyTo(RestFn.java:139)","clojure.core$apply.invoke(core.clj:626)","compojure.core$routes$fn1175.invoke(core.clj:117)","datasnap_core.api.auth_middleware$authorize_request$fn64.invoke(auth_middleware.clj:126)","datasnap_core.api.auth_middleware$authenticate_request$fn48.invoke(auth_middleware.clj:78)","okapi.handler$validate_dates$fn9402.invoke(handler.clj:192)","ring.middleware.json$wrap_json_response$fn608.invoke(json.clj:65)","ring.middleware.params$wrap_params$fn47.invoke(params.clj:64)","ring.middleware.keyword_params$wrap_keyword_params$fn81.invoke(keyword_params.clj:35)","ring.middleware.nested_params$wrap_nested_params$fn130.invoke(nested_params.clj:84)","ring.middleware.params$wrap_params$fn47.invoke(params.clj:64)","clojure.lang.Var.invoke(Var.java:379)","ring.util.servlet$make_service_method$fn9306.invoke(servlet.clj:145)","ring.util.servlet$servlet$fn__9310.invoke(servlet.clj:154)","ring.util.servlet.proxy$javax.servlet.http.HttpServlet$ff19274a.service(Unknown Source)","org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)","org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:447)","org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)","org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)","org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)","org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)","org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)","org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)","org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)","org.eclipse.jetty.server.Server.handle(Server.java:359)","org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)","org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)","org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)","org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)","org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)","org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)","org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)","org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)","org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)","org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)","java.lang.Thread.run(Thread.java:744)"]}

ryanmmmmm commented 9 years ago

result is being returned as null because we are not using identity columns so getGeneratedKeys jdbc call returns null. adding issue to use composite keys that are not identities in the future

result (j/insert! db-spec table-name row-map)

ryanmmmmm commented 9 years ago

i think the main issue here is the SQL based error message was throwing me off, i wasn't sending :data properly and the SQL error was due to that. probably lower priority fix to throw some check that tells you :data is null

I am good for now closing ticket