看板 Python 關於我們 聯絡資訊
各位大大 在djangobook上有一段說明為啥要data model的地方看不太懂 有人可以幫忙解說一下嗎? 這裏的introspection是指? 感謝 http://djangobook.com/django-models/ Introspection requires overhead and is imperfect. In order to provide convenient data-access APIs, Django needs to know the database layout somehow, and there are two ways of accomplishing this. The first way would be to explicitly describe the data in Python, and the second way would be to introspect the database at runtime to determine the data models.This second way seems cleaner, because the metadata about your tables lives in only one place, but it introduces a few problems. First, introspecting a database at runtime obviously requires overhead. If the framework had to introspect the database each time it processed a request, or even only when the Web server was initialized, this would incur an unacceptable level of overhead. (While some believe that level of overhead is acceptable, Django’s developers aim to trim as much framework overhead as possible.) Second, some databases, notably older versions of MySQL, do not store sufficient metadata for accurate and complete introspection. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.226.168.84 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1476496575.A.7BB.html ※ 編輯: left (36.226.168.84), 10/15/2016 09:57:46
IMPOSSIBLEr: introspection我不知道中文翻什麼,不過這個就像是 10/16 12:55
IMPOSSIBLEr: JAVA的REFLECTION 10/16 12:55
IMPOSSIBLEr: 抱歉,我重看了一次,這理的introspection不非是py 10/16 13:04
IMPOSSIBLEr: thon裡的introspection,這裡純綷指的是去讀databa 10/16 13:04
IMPOSSIBLEr: se的schema,這樣作的話就可以動態取得資料型別, 10/16 13:04
IMPOSSIBLEr: 但會造成無法接受的overhead,也就是方便性和overh 10/16 13:04
IMPOSSIBLEr: ead的tradeoff 10/16 13:04