Skip to main content
Question

Cognite Raw Staging SDK returns empty pandas dataframe

  • March 24, 2026
  • 5 replies
  • 40 views

We have a Cognite Function in which we are retrieving rows from staging tables using below sdk command

client.raw.rows.retrieve_dataframe(db_name, tbl_name, limit=-1)

The problem we are facing is the above command returns an empty Dataframe (0 columns, 0 rows) even though the table exists with data. The code execution does not fail but returns an empty Dataframe.

When I manually/locally run the above command on the same database and tables, I get the required data.

However, when running inside a CDF function it returns a Dataframe with shape (0,0)

 

5 replies

Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

As a diagnostic step, try using a small finite limit instead of -1 inside the function:

df = client.raw.rows.retrieve_dataframe(db_name, tbl_name, limit=5)
print(df)

 


  • Author
  • Committed
  • March 25, 2026

Hey ​@Mithila Jayalath - Sure will try that.

Also I tried using below and this seems to be working fine

client.raw.rows.list(db_name, table_name, limit=None).to_pandas()

Will also try limiting the rows with retrieve_dataframe and see how it behaves.


  • Author
  • Committed
  • March 25, 2026

Hi ​@Mithila Jayalath 

I tested the row table data retrieval with different setting and had below observation.

**NOTE: I am reading data from a table that has 315 rows & 12 columns

  • With `limit = 5`, we are getting 5 rows in the df

     

  • With `limit = -1`, the behavior is very erratic. Sometimes we received DF of shape (0, 0), sometime the same table return DF of shape (171, 12) and also had instances where a DF of shape (167, 12) is returned

 

  • With `limit=None`, I am getting the right results - DF of shape (315, 12)

Based on my observations, there seems to be some issues with `limit = -1` settings while using retrieve_dataframe.

Can you please check and confirm.


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

@DipeshY I’ll check on this and get back to you with an update.


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

@DipeshY I checked from my end and I was able to reproduce the same behaviour. I’ll create a support ticket for this issue. The support team will get back to you with an update.

Thank you for reporting this issue.