0 votes
151 views

I am trying to cross-match a Datalab table and a csv I have on my local computer. To do so, I uploaded the table to MyDB (successfully), but then when trying to access said table from MyDB, I get the message: Error: relation "mydb.table" does not exist. This happened when simply trying the cross-match and when simply accessing the table using: 

sql = """SELECT * FROM mydb://table"""

db_table = qc.query(sql=sql)

I believe I have formatted the table correctly, and don't know what else might be the problem. Is there something I've missed?

Here are the first few rows of the csv:

idradec
5463115563480388352149.92768922574197-31.2162
5938543394967135744254.00055092028342-48.5869
5860529677710780160183.82948532705507-66.5282

 

Thank you!
by annaprenowitz (120 points) | 151 views

1 Answer

0 votes

Thank for reaching out. Could you please post the first few rows of your csv file without any formatting? Specifically, I'd like to confirm that the file is comma-separated, and has no whitespaces. I.e., it should be:

id,ra,dec
5463115563480388352,149.92768922574197,-31.2162
5938543394967135744,254.00055092028342,-48.5869
5860529677710780160,183.82948532705507,-66.5282

If your CSV file is not exactly like this, please try to import again with a CSV file cleaned appropriately.

Second possibility: when you create the mydb table 'table', please make sure that such a table does not already exists. It if does, either drop it first (you can for instance add the drop=True argument to qc.mydb_import() ), or import into a mydb table with a different name.

Finally, just to be sure, also check if your login token is still correct. I am pretty sure it is, otherwise importing should not work. But just to be sure.

Please let us know if none of these work.
(By the way, is the table name really 'table' in your mydb? (just in case we need to look into your mydb).

Best,
Robert for the DL team

by robertdemo (8.9k points)
Thank you for your quick response. As far as I can tell, none of these are the problem.

Here are the first few lines of the csv, it seems properly comma separated:
id,ra,dec
5463115563480388352,149.92768922574197,-31.21624739
5938543394967135744,254.00055092028342,-48.58687189
5860529677710780160,183.82948532705507,-66.52822064

There is not another copy of a table with the same name in MyDB, and as it has sucessfuly imported to MyDB, I don't think that is the problem? Though could this be a problem when then accessing the data also?

The login token seems fine - I just checked that again. I also tried accessing the table using the online cross-match service, and got the same error message.

And no! The real table name is "gaia_erosita_matches2" in MyDB.

Thanks again.
Anna
Hi Anna,

we had a look at the logs, and it looks like your import did not work (despite it returning a success (200) status code. The table doe not exists in mydb (even if the info about the table may).

Would you mind trying to import again? And if you don't mind posting here the exact command / call you used for importing yoru CSV file?

Thanks,
Robert
Hi Robert,

I just tried it again, and I actually seem to be getting an error now when trying to import directly into MyDB using the command:
qc.mydb_import('gaia_erosita_matches3', path_to_local_file)

I think I only got a success message for this when uploading it manually online.

But get a success message when importing to VOSpace using:
sc.put(path_to_local_file, 'vos://gaia_erosita_matches2')

Thank you.
Anna
Hi Anna,

I can think of two things that might be causing it. 1) How do you specify the path_to_local_file? Just to make sure the file is actually where it's supposed to be. 2) Maybe there is a faulty row somewhere in your .csv file? If the file is not huge, could you maybe copy it 1:1 to your vospace, in the public/ directory? (this directory is by default readable to all users. (alternatively, you could also zip the csv file and email it to datalab@noirlab.edu, and we can take a look.)

Thanks,
Robert

451 questions

463 answers

474 comments

659 users

Welcome to Data Lab Help Desk, where you can ask questions and receive answers from other members of the community.

Categories