Advertisement
Guest User

Untitled

a guest
Feb 27th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 7,
  6. "metadata": {
  7. "collapsed": true
  8. },
  9. "outputs": [],
  10. "source": [
  11. "import pymysql\n",
  12. "connection = pymysql.connect(host='paws-db',\n",
  13. " user='cscw',\n",
  14. " password='cscw',\n",
  15. " cursorclass=pymysql.cursors.DictCursor\n",
  16. " )"
  17. ]
  18. },
  19. {
  20. "cell_type": "code",
  21. "execution_count": 8,
  22. "metadata": {
  23. "collapsed": false
  24. },
  25. "outputs": [
  26. {
  27. "name": "stdout",
  28. "output_type": "stream",
  29. "text": [
  30. "{'questioner_replies': 0, 'rev_timestamp': datetime.datetime(2012, 2, 27, 21, 29, 7), 'first_answer_date': datetime.datetime(2012, 2, 27, 22, 31, 12), 'post_date': b'2012-02-27 21:29:07', 'rev_user': 14519241, 'answers': 9, 'rev_id': 479187628, 'rev_comment': b'New question: What are you editing today?'}\n"
  31. ]
  32. }
  33. ],
  34. "source": [
  35. "with connection.cursor() as cur:\n",
  36. " cur.execute('use datasets_p;')\n",
  37. " cur.execute('SELECT * FROM teahouse_questions_20150412 LIMIT 1')\n",
  38. " print(cur.fetchone())"
  39. ]
  40. },
  41. {
  42. "cell_type": "code",
  43. "execution_count": null,
  44. "metadata": {
  45. "collapsed": true
  46. },
  47. "outputs": [],
  48. "source": []
  49. }
  50. ],
  51. "metadata": {
  52. "kernelspec": {
  53. "display_name": "Python 3",
  54. "language": "python",
  55. "name": "python3"
  56. },
  57. "language_info": {
  58. "codemirror_mode": {
  59. "name": "ipython",
  60. "version": 3
  61. },
  62. "file_extension": ".py",
  63. "mimetype": "text/x-python",
  64. "name": "python",
  65. "nbconvert_exporter": "python",
  66. "pygments_lexer": "ipython3",
  67. "version": "3.4.2"
  68. }
  69. },
  70. "nbformat": 4,
  71. "nbformat_minor": 0
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement