[{"data":1,"prerenderedAt":206},["ShallowReactive",2],{"project-4648892":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":33,"aspects":34,"strip":36,"post_text":40,"what":41,"said":68,"maker_in_thread":138,"shape":142,"grid":146,"attempts":169,"same_week":170,"maker_shows":145,"maker_hidden":198,"reader_version":199,"card":200},"4648892","django-model-parser","Django Model Parsing with Python's AST module","title","Show HN: Django Model Parsing with Python's AST module","https:\u002F\u002Fgithub.com\u002Ffatiherikli\u002Fdjango-model-parser","github.com","fatiherikli",1350145439,2012,23,13,860,1677,52,"shown","dev_tools","code parser","library",[24,25,26,27],"django","ast parser","python models","database schema","mixed",0.024,{"positive":31,"neutral":32,"mixed":32,"critical":31},1,2,6,{"idea":35},{"positive":31,"critical":31},[37,38,38,38,38,37,38,31,37,38,38,37,39],3,0,5,null,{"problem":42,"audience":40,"pricing":40,"motivation":52,"time_to_build":40,"stack":56,"openness":67,"stage":67,"team_size":67},{"value":43,"source":44,"evidence":45},"Reading Django model definitions without executing the uploaded code","maker",[46,49],{"id":47,"by":11,"text":48},"4649189","I will use it for generating database schema of uploaded django models. It's my use case. Because sandboxing in python is too hard, I can not execute uploaded python script.",{"id":50,"by":11,"text":51},"4649295","It's true, but the _meta way is not convenient for my use case. I am parsing uploaded python script (django model).",{"value":53,"source":44,"evidence":54},"Generate database schema from uploaded Django models without running untrusted code",[55],{"id":47,"by":11,"text":48},[57,63],{"value":58,"source":59,"evidence":60},"Python","inferred",[61],{"id":62},"post",{"value":64,"source":59,"evidence":65},"Django",[66],{"id":62},"unknown",{"praise":69,"objections":82,"requests":104,"questions":105,"alternatives":120},[70],{"value":71,"source":72,"evidence":73},"Neat project and good for learning parsing with the AST module","commenter",[74,78],{"id":75,"by":76,"text":77},"4649096","mattdeboard","Neat. The AST module was a good way for me as a novice-intermediate programmer to get better acquainted with parsing. I have a small module that parses raw Solr-style…",{"id":79,"by":80,"text":81},"4649272","natrius","Parsing the text of models isn't the best way to get information about them. The _meta attribute of a model provides tons of information about a model, its fields, and how to…",[83,87,94],{"value":84,"source":72,"evidence":85},"The _meta attribute is a better way to get model information",[86],{"id":79,"by":80,"text":81},{"value":88,"source":72,"evidence":89},"Unclear use case for turning models into dictionaries",[90],{"id":91,"by":92,"text":93},"4649166","DanielN","This seems really cool, but I'm having some trouble coming up with a use case for this. Why would I want to translate my django model to a dictionary?",{"value":95,"source":72,"evidence":96},"Parsing can't avoid running code if it is a manage.py based approach",[97,101],{"id":98,"by":99,"text":100},"4649250","lmz","doesn't that import the modules i.e. execute them?",{"id":102,"by":80,"text":103},"4649259","This project is a Python module. It has to be executed at some point. Presumably, you'd generate the SQL locally by running manage.py sqlall, then get the SQL to your database in…",[],[106,112],{"value":107,"source":72,"evidence":108},"How does the parser work without executing uploaded code?",[109],{"id":110,"by":80,"text":111},"4649326","I don't understand how you can run your parser if you can't run arbitrary Python code.",{"value":113,"source":72,"evidence":114},"What is the use case for the dictionary output?",[115,116],{"id":91,"by":92,"text":93},{"id":117,"by":118,"text":119},"4649194","__alexs","Can you explain some more? That sounds like what the ORM Models already do.",[121,125,131],{"value":122,"source":72,"evidence":123},"Django _meta attribute",[124],{"id":79,"by":80,"text":81},{"value":126,"source":72,"evidence":127},"manage.py sqlall",[128],{"id":129,"by":76,"text":130},"4649201","manage.py sqlall ?",{"value":132,"source":72,"evidence":133},"django-extensions graph_models",[134],{"id":135,"by":136,"text":137},"4650454","shabble","That assumes your end goal is actually using the provided models in your application. It sounds like this is using them as pure data only. I can think of a couple of reasons why…",{"comments":32,"answered":31,"key":139},[140,141],{"id":50,"text":51},{"id":47,"text":48},{"commenters":143,"max_depth":33,"maker_replies":32,"first_comment_mins":144,"lifespan_hours":145},8,71,11,[147,149,151,153,157,159,160,161,163,164,165,166,167],[79,38,37,148,80,38],"project\u002Fmixed\u002Fidea",[50,38,38,150,11,31],"project\u002Fneutral\u002Fidea",[110,38,38,152,80,38],"commenter\u002Fneutral\u002Fnone",[154,38,38,155,156,38],"4649350","commenter\u002Fneutral\u002Fprivacy","mcantelon",[158,38,38,152,80,38],"4649386",[91,31,37,148,92,38],[47,31,38,150,11,31],[117,31,31,162,118,38],"project\u002Fcritical\u002Fidea",[129,31,37,150,76,38],[98,31,38,152,99,38],[102,31,38,152,80,38],[135,31,37,150,136,38],[75,32,39,168,76,38],"project\u002Fpositive\u002Fidea",[],[171,176,181,186,190,194],{"id":172,"name":173,"points":174,"category":175},"4643175","Selfstarter",463,"web_saas",{"id":177,"name":178,"points":179,"category":180},"4656850","dbpatterns",125,"learning_science",{"id":182,"name":183,"points":184,"category":185},"4656378","What would Paul Graham do?",109,"productivity",{"id":187,"name":188,"points":189,"category":180},"4642330","LearnStreet",101,{"id":191,"name":192,"points":193,"category":175},"4658794","Five Year Itch",86,{"id":195,"name":196,"points":197,"category":185},"4650530","doc-edit",81,false,"v2",{"id":201,"name":5,"line":6,"ai":198,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":202,"top":18,"kw":203,"maker":11,"domain":10,"tier":19,"attempts":38,"strip":204,"url":9,"mix":205,"praise":71,"objection":84,"sub":21},4648892,0.02,[24,25,26,27],"3000030130035",[31,32,32,31],1794036500332]