alculquicondor / psqlparse

A python module that gives access to PostgreSQL's query parser, for turning SQL into a parse tree.
BSD 3-Clause "New" or "Revised" License
164 stars 41 forks source link

Error: 'Statement' object has no attribute 'tables' #24

Closed Maya-BF closed 7 years ago

Maya-BF commented 7 years ago

Hi,

Trying to access the list of tables as in the example in the read.me,

`import psqlparse statements = psqlparse.parse('SELECT * from mytable') used_tables = statements[0].tables() # ['my_table']

I get an error:

Attribute error: 'Statement' object has no attribute 'tables'.

Also dir(statements[0]) gives: ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_obj', 'from_clause', 'target_list', 'type', 'where_clause', 'with_clause']

alculquicondor commented 7 years ago

Did you install from pip (in that case, which version) or did you use master branch?

Maya-BF commented 7 years ago

Installed from pip version 0.2.5

alculquicondor commented 7 years ago

tables is only supported in 1.0 release candidates.