Get streamed data from raw query
See original GitHub issueIssue type:
[X] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[X] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[X] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
Hello,
Is there a way to get streamed data from a raw query? I am calling a stored procedure that return a table of some hundred thousands of lines and write the data to a .csv file. Here is the syntax of the query in postgresql:
SELECT * FROM get_message_for_enterprise(10)
I can get the result in form of list with EntityManager.query but that will use too much memory.
It would be simple if I could use QueryBuilder to create this kind of query but it doesn’t seem to be possible.
Any hints on how to do this please?
Cheers, David
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (6 by maintainers)
You can use
connection.manager.queryRunner.stream("SELECT * FROM get_message_for_enterprise(10)");
function for now.But I think this is relevant request and maybe we should add
stream
method to manager and repository api.@pleerock Should we not expose
stream
method inEntityManager
same asquery
method?