2

According to WRDS (large data provider) itself, one can list the different libraries of data they provide by doing the following (source):

import wrds

db = wrds.Connection()

db.list_libraries()

This works fine for me. One can then look at all the different tables in a library by doing the following:

db.list_tables(library='comp')

where "comp", is an examplatory library.

However, when I do this, I get the following error:

ProgrammingError: (psycopg2.errors.UndefinedColumn) column c.relnamespace does not exist
LINE 1: ...me FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnames...
                                                             ^

[SQL: SELECT c.relname FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = %(schema)s AND c.relkind IN ('v', 'm')]
[parameters: {'schema': 'comp'}]
(Background on this error at: http://sqlalche.me/e/13/f405)

What is my mistake here? Thanks in advance.

shenflow
  • 345
  • 2
  • 12
  • 1
    What version of Postgresql are you using? – snakecharmerb Apr 27 '21 at 15:48
  • @snakecharmerb the only package I am working with is the wrds one. So I am not aware of that. I guess postgresql is part of the wrds package? If so - how do I check which version I am using? – shenflow Apr 27 '21 at 22:28
  • Oh I see, the server is remote. What's the result of `db.raw_sql("SELECT version()")`? – snakecharmerb Apr 28 '21 at 06:59
  • The result is: version 0 PostgreSQL 12.5 on x86_64-pc-linux-gnu, compil... – shenflow Apr 28 '21 at 07:06
  • Hmmm. I can see that column definitely exists in 12.4. Does it show in the output of `db.raw_sql("\d pg_class")`? – snakecharmerb Apr 28 '21 at 07:25
  • It gives me the following: `ProgrammingError: (psycopg2.errors.SyntaxError) syntax error at or near "\" LINE 1: \d pg_class ^ [SQL: \d pg_class] (Background on this error at: http://sqlalche.me/e/13/f405)` – shenflow Apr 28 '21 at 08:45
  • I think the best thing to do is raise a support ticket with the WRDS people (there's a link on their site). `relnamespace` certainly exists in older and later versions of Postgresql, so perhaps there's a problem with your account setup. – snakecharmerb Apr 28 '21 at 09:53
  • 1
    @snakecharmerb WRDS appeared to have problems - it was not any fault on my side. They fixed it now - thanks. – shenflow Apr 30 '21 at 08:25

0 Answers0