0

I have a mysql db set up on RDS on AWS (I ported the db from my personal computer), and have set up a datajoint connection to the db on Sagemaker in a Jupyter notebook. Say I have a table mouse, which has a column mouse_id. Datajoint returns the same mouse.size_on_disk as it does on my personal computer, so even from Sagemaker it is showing the data is there (I also know the data is there, as when I remote in to the RDS at AWS using mysql workbench I see it directly).

But when I try to fetch, e.g., mouse.fetch('mouse_id') I am getting an empty array back. Is there some setting that needs to be tweaked for fetch() to work?

Here is some sample code:

import datajoint as dj

# connect to server
dj.config['database.host'] = 'ip_address_here'
dj.config['database.user'] = 'admin'
dj.config['database.password'] = 'not_my_password'
dj.conn()

# define table/fetch data
from pipeline.tables import Mouse
mouse_table = Mouse()

mouse_table.size_on_disk  #16k on both systems
print(len(mouse_table)) # 22 on personal, 0 on AWS

mouse_names = mouse_table.fetch('mouse_id')  # full on personal, empty on AWS
eric
  • 7,142
  • 12
  • 72
  • 138

1 Answers1

0

I found the error/solution. When I created an RDS instance at AWS (using their GUI), I had to pick a db name, and I picked some random name nd (for neural data), and didn't even think about it.

However, in my local pipeline when I defined the database schema I had already named it something else (fc for fear conditioning):

schema = dj.schema(schema_name = 'fc', context = locals())

This line was in the code I uploaded to AWS. The fix that worked: in AWS, I went into my module and changed that line so that the schema name matches the new db name in the RDS:

schema = dj.schema(schema_name = 'nd', context = locals())

Now fetch works!

eric
  • 7,142
  • 12
  • 72
  • 138