New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omit full table path in join query results. #7605
Comments
With |
I have already implemented this and was afraid that it would be your answer. I would like to request that columns with a column alias be given the option to be specified explicitly and honored even in a join. This becomes a problem when dealing with consumers that expect a certain payload, because part of an api must be written in a non-standard way to compensates for this. |
I agree, there should be a way to get aliased names, may be we can tackle it in #5708 |
I've managed to get this working by including the joined attributes in the main I.e. instead of
you could try
I think the fact this works might not be explicitly intended behavior, however, and might change in the future. But at least for me it's currently working. Edit: I'm using this against a MySQL database and my Sequelize version is 3.30.4. |
I have same problem. I'm using findAndCountAll method and it concat me table name to column name. So response is really "bad" if you are using it with graphql... |
I have been trying to do this approach and I can't get the same result. Perhaps because Sequelize has changed?! Can you get the same result yet? |
Hi, This should do the trick,
|
That's RIGHT dude, that's it! |
thanks for this!! |
I am trying to omit the full table path (e.g.
tableB.column
) from results in a raw query using a join. Is there a mechanism for doing this, or a workaround? I believe that this is related to issue #4311.I have tried aliasing the column, but it still added the prefix.
What you are doing?
I am executing a query that looks something like the following:
What do you expect to happen?
I'd like to see output that does not include
tableB
and resembles:What is actually happening?
I am getting output that resembles:
Dialect: postgres
Database version: 9.6.2
Sequelize version: 3.30.4
The text was updated successfully, but these errors were encountered: