Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "import pymysql\n",
- "connection = pymysql.connect(host='paws-db',\n",
- " user='cscw',\n",
- " password='cscw',\n",
- " cursorclass=pymysql.cursors.DictCursor\n",
- " )"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "{'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"
- ]
- }
- ],
- "source": [
- "with connection.cursor() as cur:\n",
- " cur.execute('use datasets_p;')\n",
- " cur.execute('SELECT * FROM teahouse_questions_20150412 LIMIT 1')\n",
- " print(cur.fetchone())"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.4.2"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement