README 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. We are happy to add features to dakweb if you have a need for them.
  2. Here are a few tips to help you get started on creating a dakweb patch:
  3. 1. dakweb is implemented in Python, using the bottle web microframework and the
  4. sqlalchemy ORM (object relational mapper).
  5. In a nutshell, bottle allows us to expose Python functions via
  6. HTTP. Parameters are automatically taken from the @bottle.route function
  7. annotation and passed to the function.
  8. For upstream documentation, see:
  9. https://bottlepy.org/docs/dev/
  10. http://www.sqlalchemy.org/
  11. When browsing upstream documentation, keep in mind that we are using the
  12. versions installed on mirror.ftp-master.debian.org, which is usually running
  13. Debian stable. In other words: the latest documentation might not be
  14. applicable yet.
  15. 2. The bulk of adding a new query is coming up with the actual database query
  16. (as opposed to the plumbing). To get fast turn-around times while developing,
  17. you can use the ipython REPL:
  18. % ssh mirror.ftp-master.debian.org
  19. mirror % cd /srv/ftp-master.debian.org/dak/
  20. mirror % PYTHONPATH=. ipython
  21. ipython % from daklib.dbconn import *
  22. ipython % s = DBConn().session()
  23. Then, to evaluate a query, construct it and call the all method, e.g.:
  24. ipython % s.query(DBBinary.package, DBSource.source, SourceMetadata.value).join(DBSource).join(SourceMetadata).join(MetadataKey).filter(MetadataKey.key == 'Go-Import-Path').group_by(DBBinary.package, DBSource.source, SourceMetadata.value).all()