question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get streamed data from raw query

See original GitHub issue

Issue 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:closed
  • Created 5 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
vlapocommented, Jan 2, 2019

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.

2reactions
vlapocommented, Jan 21, 2019

@pleerock Should we not expose stream method in EntityManager same as query method?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Server Streaming: Easy Way To Stream Data In Real-Time
This blog teaches about how to perform SQL server streaming of data easily. It provides a step-by-step guide to implement these concepts ...
Read more >
Get data stream API | Elasticsearch Guide [8.5] | Elastic
Query DSL · Query and filter context · Compound queries ... Retrieves information about one or more data streams. See Get information about...
Read more >
How to get Stream TypeORM result (SQL Server) by query ...
You can use stream() with createQueryBuilder() but you'll have to manually unmarshall the chunks from the data handler.
Read more >
What is Streaming SQL? - Materialize
Summary. Streaming SQL is about taking the same declarative SQL used to write database queries, and instead running it on streams of fast-changing...
Read more >
SqlClient Streaming Support - ADO.NET - Microsoft Learn
The members added to support streaming are used to retrieve data from queries and to pass parameters to queries and stored procedures. The ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found