[ 
https://issues.apache.org/jira/browse/MADLIB-1204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16548292#comment-16548292
 ] 

Nandish Jayaram commented on MADLIB-1204:
-----------------------------------------

w/ [~jingyimei]
 We were unable to reproduce this issue on current master, 1.14 and 1.13. The 
python version in our environment was 2.7.15.
 Will go ahead and close this issue as no-op, please reopen it if you can 
reproduce this in future.
  

> madpack: SQL result parsing is fragile
> --------------------------------------
>
>                 Key: MADLIB-1204
>                 URL: https://issues.apache.org/jira/browse/MADLIB-1204
>             Project: Apache MADlib
>          Issue Type: Bug
>          Components: Madpack
>            Reporter: Rahul Iyer
>            Assignee: Nandish Jayaram
>            Priority: Major
>             Fix For: v1.15
>
>
> For a reinstall operation, {{madpack}} looks at any possible affected objects 
> that will dropped using below query: 
> {code}
>   affected_objects = _internal_run_query("""
>             SELECT
>                 n1.nspname AS schema,
>                 relname AS relation,
>                 attname AS column,
>                 typname AS type
>             FROM
>                 pg_attribute a,
>                 pg_class c,
>                 pg_type t,
>                 pg_namespace n,
>                 pg_namespace n1
>             WHERE
>                 n.nspname = '%s'
>                 AND t.typnamespace = n.oid
>                 AND a.atttypid = t.oid
>                 AND c.oid = a.attrelid
>                 AND c.relnamespace = n1.oid
>                 AND c.relkind = 'r'
>             ORDER BY
>                 n1.nspname, relname, attname, typname""" % schema.lower(), 
> True)
> {code}
> The results of this query is parsed line-by-line in the function 
> {{run_query}}. 
> For my database, a clean reinstall gives following result for above query
> {code}
>  schema | relation | column | type
> --------+----------+--------+------
> (0 rows)
> {code}
> This is parsed as
> {code}
> [{'schema': '(0 rows)'}]
> {code} by the function, which is clearly incorrect and leads to an error in 
> subsequent lines: 
> {code}
>   File ".../madpack/madpack.py", line 1366, in <module>
>     main(sys.argv[1:])
>   File ".../madpack/madpack.py", line 1136, in main
>     ao['column'] + ' : ' + ao['type'], True)
> KeyError: 'relation'
> {code} 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to