<commit_before>{
 "metadata": {
  "name": "",
  "signature": "sha256:f703ea3fdd023516d926fc6cf563c328fd91e9db528f4a577d8e666a4fe78a99"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Native Driver Introduction"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# this is necessary to get inline plots from matplotlib\n",
      "%matplotlib inline "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "We're going to assume a keyspace named tutorial exists\n",
      "In a CQL shell, we can do this:\n",
      "\n",
      "> CREATE KEYSPACE tutorial WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};\n",
      "\n",
      "we'll create the rest of the tables programatically"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# here we set up our database connection\n",
      "from cassandra.cluster import Cluster\n",
      "cluster = Cluster()\n",
      "\n",
      "# a session manages the connection pool for us\n",
      "session = cluster.connect(\"tutorial\")\n",
      "print \"Connected\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# basic table setup\n",
      "tables = [\"photo\", \"comment\"]\n",
      "\n",
      "# drop the existing ones\n",
      "for table in tables:\n",
      "    session.execute(\"DROP TABLE if exists %s\" % table)\n",
      "    \n",
      "photo = \"\"\"\n",
      "CREATE TABLE photo (\n",
      "  photo_id uuid,\n",
      "  name text,\n",
      "  PRIMARY KEY (photo_id)\n",
      ")\n",
      "\"\"\"\n",<commit_msg>drop table information<commit_after>{
 "metadata": {
  "name": "",
  "signature": "sha256:a7aa15bb8302fafa48a6da4d8f1127e15963948dd15973b1c6377258f6b8b134"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Native Driver Introduction"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# this is necessary to get inline plots from matplotlib\n",
      "%matplotlib inline "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "We're going to assume a keyspace named tutorial exists\n",
      "In a CQL shell, we can do this:\n",
      "\n",
      "> CREATE KEYSPACE tutorial WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};\n",
      "\n",
      "we'll create the rest of the tables programatically"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# here we set up our database connection\n",
      "from cassandra.cluster import Cluster\n",
      "cluster = Cluster()\n",
      "\n",
      "# a session manages the connection pool for us\n",
      "session = cluster.connect(\"tutorial\")\n",
      "print \"Connected\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# basic table setup\n",
      "tables = [\"photo\", \"comment\"]\n",
      "\n",
      "# drop the existing ones.  can't use a placeholder for DROP TABLE so we just use python string interpolation\n",
      "for table in tables:\n",
      "    session.execute(\"DROP TABLE if exists %s\" % table)\n",
      "    \n",
      "photo = \"\"\"\n",
      "CREATE TABLE photo (\n",
      "  photo_id uuid,\n",
      "  name text,\n",
      "  PRIMARY KEY (photo_id)\n",
      ")\n",
      "\"\"\"\n",
{'fraction_non_alphanumeric': 0.18469259723964868, 'fraction_numerical': 0.024341279799247176, 'mean_word_length': 2.1410559495665877, 'pattern_counts': {'":': 60, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4359309', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1344, 'n_words': 333}