Comments (6)
Can you run your server with the following environment variable, try the query again, and post the additional output? DEBUG=join-monster
Also, please use markdown code blocks when posting code, as it becomes much more readable. This can be done with 3 backticks.
from join-monster.
This what I see in debug mode. I do see the values populating correctly in here but its not displayed in the GraphIql
join-monster
join-monster SQL_AST
join-monster { args: { id: 183517 },
type: 'table',
name: 'AP_INVOICES_ALL',
as: 'invoice',
children:
[ { type: 'column',
name: 'INVOICE_ID',
fieldName: 'INVOICE_ID',
as: 'INVOICE_ID' },
{ type: 'column',
name: 'INVOICE_ID',
fieldName: 'invoice_id',
as: 'INVOICE_ID' },
{ type: 'column',
name: 'INVOICE_NUM',
fieldName: 'invoice_num',
as: 'INVOICE_NUM' },
{ type: 'column',
name: 'INVOICE_AMOUNT',
fieldName: 'invoice_amount',
as: 'INVOICE_AMOUNT' },
{ type: 'column',
name: 'INVOICE_CURRENCY_CODE',
fieldName: 'invoice_currency_code',
as: 'INVOICE_CURRENCY_CODE' },
{ type: 'table',
name: 'AP_BATCHES_ALL',
as: 'batches',
children:
[ { type: 'column',
name: 'BATCH_ID',
fieldName: 'BATCH_ID',
as: 'BATCH_ID' },
{ type: 'column',
name: 'batch_name',
fieldName: 'batch_name',
as: 'batch_name' },
{ type: 'column',
name: 'created_by',
fieldName: 'created_by',
as: 'created_by' },
{ type: 'columnDeps', names: {} } ],
fieldName: 'batches',
grabMany: true,
sqlJoin: [Function: sqlJoin] },
{ type: 'columnDeps', names: {} } ],
fieldName: 'invoice',
grabMany: false,
where: [Function: where] } +0ms
join-monster
join-monster SQL
join-monster SELECT
"invoice"."INVOICE_ID" AS "INVOICE_ID",
"invoice"."INVOICE_NUM" AS "INVOICE_NUM",
"invoice"."INVOICE_AMOUNT" AS "INVOICE_AMOUNT",
"invoice"."INVOICE_CURRENCY_CODE" AS "INVOICE_CURRENCY_CODE",
"batches"."BATCH_ID" AS "batches__BATCH_ID",
"batches"."batch_name" AS "batches__batch_name",
"batches"."created_by" AS "batches__created_by"
FROM AP_INVOICES_ALL AS "invoice"
LEFT JOIN AP_BATCHES_ALL AS "batches" ON "invoice".BATCH_ID = "batches".BATCH_ID
WHERE "invoice".invoice_id = 183517 +6ms
join-monster
join-monster SHAPE_DEFINITION
join-monster { INVOICE_ID: 'INVOICE_ID',
invoice_id: 'INVOICE_ID',
invoice_num: 'INVOICE_NUM',
invoice_amount: 'INVOICE_AMOUNT',
invoice_currency_code: 'INVOICE_CURRENCY_CODE',
batches:
[ { BATCH_ID: 'batches__BATCH_ID',
batch_name: 'batches__batch_name',
created_by: 'batches__created_by' } ] } +2ms
sql SELECT
"invoice"."INVOICE_ID" AS "INVOICE_ID",
"invoice"."INVOICE_NUM" AS "INVOICE_NUM",
"invoice"."INVOICE_AMOUNT" AS "INVOICE_AMOUNT",
"invoice"."INVOICE_CURRENCY_CODE" AS "INVOICE_CURRENCY_CODE",
"batches"."BATCH_ID" AS "batches__BATCH_ID",
"batches"."batch_name" AS "batches__batch_name",
"batches"."created_by" AS "batches__created_by"
FROM AP_INVOICES_ALL AS "invoice"
LEFT JOIN AP_BATCHES_ALL AS "batches" ON "invoice".BATCH_ID = "batches".BATCH_ID
WHERE "invoice".invoice_id = 183517
sql1 SELECT
invoice.INVOICE_ID AS INVOICE_ID,
invoice.INVOICE_NUM AS INVOICE_NUM,
invoice.INVOICE_AMOUNT AS INVOICE_AMOUNT,
invoice.INVOICE_CURRENCY_CODE AS INVOICE_CURRENCY_CODE,
batches.BATCH_ID AS batches__BATCH_ID,
batches.batch_name AS batches__batch_name,
batches.created_by AS batches__created_by
FROM AP_INVOICES_ALL invoice
LEFT JOIN AP_BATCHES_ALL batches ON invoice.BATCH_ID = batches.BATCH_ID
WHERE invoice.invoice_id = 183517
join-monster
join-monster RAW DATA
join-monster [ { INVOICE_ID: 183517,
INVOICE_NUM: 'IBY707.1A-12',
INVOICE_AMOUNT: 100,
INVOICE_CURRENCY_CODE: 'USD',
BATCHES__BATCH_ID: 30129,
BATCHES__BATCH_NAME: 'External:306',
BATCHES__CREATED_BY: 'CVBUYER01' } ] +56ms
join-monster 1 rows... +1ms
from join-monster.
@praseedasathaye well this is odd. The debug info you just posted doesn't seem to match the schema in the JavaScript code you pasted in your first comment. The table names from the debug info are AP_INVOICES_ALL
and AP_BATCHES_ALL
. But in your schema they are named INVOICES
and BATCHES
. Are you sure you required the right schema file?
I think I understand now. The problem is here:
{ type: 'table',
name: 'AP_BATCHES_ALL',
as: 'batches',
children:
[ { type: 'column',
name: 'BATCH_ID',
fieldName: 'BATCH_ID',
as: 'BATCH_ID' },
{ type: 'column',
name: 'batch_name',
fieldName: 'batch_name',
as: 'batch_name' },
{ type: 'column',
name: 'created_by',
fieldName: 'created_by',
as: 'created_by' },
For some reason Join Monster thinks the SQL column for the batch_name
field is called batch_name
. And it thinks the column for the created_by
field is called created_by
. But they should be capitalized. The schema you posted configured this correctly, but I suspect that may not be the actual schema that Join Monster was passed. Can you double check that? And make sure sqlColumn
property is there on the created_at
and batch_name
fields and that sqlColumn
is spelled correctly with a capital C.
You've also modified the SQL query to remove the double quotes. Once the previously mentioned thing is corrected, you should keep the double quotes there, for the double quotes ensure the correct letter case. The column names in the result were returned to the application with the incorrect case.
from join-monster.
When I posted this issue I was using a different database so the table names are different. Sorry for the confusion.
I added the sqlColumn to both fields.
export default new GraphQLObjectType({
description: 'A post from a user',
name: 'Batch',
// another table in SQL to map to
sqlTable: 'AP_BATCHES_ALL',
uniqueKey: 'BATCH_ID',
fields: () => ({
id: {
// SQL column assumed to be "id"
type: GraphQLInt
},
batch_name: {
description: 'The content of the post',
// assumed to be "body"
type: GraphQLString,
sqlColumn: 'BATCH_NAME'
},
created_by: {
description: 'The user that created the post',
// a back reference to its User
type: GraphQLString,
sqlColumn: 'CREATED_BY'
}
})
})
But still I don't see the values. Its still shows as null in the graphIql o/p. Below is my debug o/p.
join-monster
join-monster SQL_AST
join-monster { args: { id: 183517 },
type: 'table',
name: 'AP_INVOICES_ALL',
as: 'invoice',
children:
[ { type: 'column',
name: 'INVOICE_ID',
fieldName: 'INVOICE_ID',
as: 'INVOICE_ID' },
{ type: 'column',
name: 'INVOICE_ID',
fieldName: 'invoice_id',
as: 'INVOICE_ID' },
{ type: 'column',
name: 'INVOICE_NUM',
fieldName: 'invoice_num',
as: 'INVOICE_NUM' },
{ type: 'column',
name: 'INVOICE_AMOUNT',
fieldName: 'invoice_amount',
as: 'INVOICE_AMOUNT' },
{ type: 'column',
name: 'INVOICE_CURRENCY_CODE',
fieldName: 'invoice_currency_code',
as: 'INVOICE_CURRENCY_CODE' },
{ type: 'table',
name: 'AP_BATCHES_ALL',
as: 'batches',
children:
[ { type: 'column',
name: 'BATCH_ID',
fieldName: 'BATCH_ID',
as: 'BATCH_ID' },
{ type: 'column',
name: 'BATCH_NAME',
fieldName: 'batch_name',
as: 'BATCH_NAME' },
{ type: 'column',
name: 'CREATED_BY',
fieldName: 'created_by',
as: 'CREATED_BY' },
{ type: 'columnDeps', names: {} } ],
fieldName: 'batches',
grabMany: true,
sqlJoin: [Function: sqlJoin] },
{ type: 'columnDeps', names: {} } ],
fieldName: 'invoice',
grabMany: false,
where: [Function: where] } +14s
join-monster
join-monster SQL
join-monster SELECT
"invoice"."INVOICE_ID" AS "INVOICE_ID",
"invoice"."INVOICE_NUM" AS "INVOICE_NUM",
"invoice"."INVOICE_AMOUNT" AS "INVOICE_AMOUNT",
"invoice"."INVOICE_CURRENCY_CODE" AS "INVOICE_CURRENCY_CODE",
"batches"."BATCH_ID" AS "batches__BATCH_ID",
"batches"."BATCH_NAME" AS "batches__BATCH_NAME",
"batches"."CREATED_BY" AS "batches__CREATED_BY"
FROM AP_INVOICES_ALL AS "invoice"
LEFT JOIN AP_BATCHES_ALL AS "batches" ON "invoice".BATCH_ID = "batches".BATCH_ID
WHERE "invoice".invoice_id = 183517 +1ms
join-monster
join-monster SHAPE_DEFINITION
join-monster { INVOICE_ID: 'INVOICE_ID',
invoice_id: 'INVOICE_ID',
invoice_num: 'INVOICE_NUM',
invoice_amount: 'INVOICE_AMOUNT',
invoice_currency_code: 'INVOICE_CURRENCY_CODE',
batches:
[ { BATCH_ID: 'batches__BATCH_ID',
batch_name: 'batches__BATCH_NAME',
created_by: 'batches__CREATED_BY' } ] } +0ms
join-monster
join-monster RAW DATA
join-monster [ { INVOICE_ID: 183517,
INVOICE_NUM: 'IBY707.1A-12',
INVOICE_AMOUNT: 100,
INVOICE_CURRENCY_CODE: 'USD',
BATCHES__BATCH_ID: 30129,
BATCHES__BATCH_NAME: 'External:306',
BATCHES__CREATED_BY: 'CVBUYER01' } ] +38ms
join-monster 1 rows... +0ms
from join-monster.
So Join Monster expects the batch name to be on the property "batches__BATCH_NAME"
. But the application received it as "BATCHES__BATCH_NAME"
. Are you still removing any double quotes? BATCHES should not have gotten capitalized if the alias was double quoted. The double quotes Join Monster adds are required. If keeping the double quotes causes an "invalid identifier" error, then that is the true issue we must address.
from join-monster.
Thank You for your excellent support!!
It did work when I put the double quotes back. So the only thing i need to do to work with Oracle DB is to remove "AS" from query to support Oracle query dialect.
from join-monster.
Related Issues (20)
- tsd failing locally HOT 2
- Fails if I extend GraphQLObjectType HOT 2
- Must call joinMonster in a resolver on a field where the type is decorated with \"sqlTable\" HOT 9
- Cannot read properties of undefined (reading 'sqlTable') HOT 2
- Failing type defs
- Issue with GlobalIDs not transforming back to "native" uuid4 IDs HOT 1
- bug in joinMonster.getNode(): def.args not iterable HOT 4
- Querying the same relation multiple times as aliases with different args results in wrong data HOT 5
- Remove requirement for uniqueKey to be defined HOT 1
- Pagination with dynamic sorting does not support null values. HOT 2
- joinMonster creating invalid MySQL sql HOT 2
- Unsupport many-to-many relation on graphql v15.8 and join-monster v3.1.1 using postgres? HOT 2
- Batching JoinMonster calls
- The HTTP server example code is broken due to deprecation of kao-graphql HOT 1
- join-monster fails to work in a react native deployment HOT 1
- Typescript type error for GraphQLFieldExtensions HOT 1
- Some disjoint fields of the same union type are discarded HOT 7
- Test flake on database startup
- Readthedocs build fails when master is updated
- Namespace/prefix generated aliases with `$` or similar HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from join-monster.