<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kite</title>
    <description>The latest articles on DEV Community by Kite (@kite).</description>
    <link>https://dev.to/kite</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F1147%2F3e2227e3-185c-4844-bff7-1b3493697fc8.png</url>
      <title>DEV Community: Kite</title>
      <link>https://dev.to/kite</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kite"/>
    <language>en</language>
    <item>
      <title>Kite Now Integrates with Jupyter</title>
      <dc:creator>brendan</dc:creator>
      <pubDate>Tue, 04 Aug 2020 17:49:31 +0000</pubDate>
      <link>https://dev.to/kite/kite-now-integrates-with-jupyter-4aoh</link>
      <guid>https://dev.to/kite/kite-now-integrates-with-jupyter-4aoh</guid>
      <description>&lt;p&gt;We’re thrilled to release a Kite integration for JupyterLab, plus special support for teams using JupyterHub. Data scientists can now get useful completions as they type in Jupyter notebooks, powered by Kite’s deep learning.&lt;/p&gt;

&lt;p&gt;Check out the new completions experience in JupyterLab below.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/k8D7kWGnoCc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s dive into the details.
&lt;/h2&gt;

&lt;p&gt;Kite automatically gives you longer completions sorted by relevance, without requiring you to run a single cell in your notebook or press &lt;code&gt;tab&lt;/code&gt; to make completions appear.&lt;/p&gt;

&lt;p&gt;Here’s a side-by-side comparison for JupyterLab’s native completions vs. Kite completions. &lt;/p&gt;

&lt;p&gt;JupyterLab native completions are alphabetically sorted and have no documentation: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0HXjdLY4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/08/JupyterLab-native-completions-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0HXjdLY4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/08/JupyterLab-native-completions-2.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whereas Kite’s completions are ranked by relevance, and Kite also shows you documentation for the highlighted completion: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cxab2tze--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/08/JupyterLab-with-Kite-completions-and-docs-panel-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cxab2tze--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/08/JupyterLab-with-Kite-completions-and-docs-panel-3.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kite then turbocharges the JupyterLab experience with additional ML-powered completions features and over 100,000 Python docs just a click away in the Kite Copilot:&lt;/p&gt;

&lt;p&gt;Kite can complete up to multiple lines of code at a time, reducing the time you spend writing repetitive, boilerplate Python: &lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MnexY2FsCx0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Import statements are a breeze with Kite, and it learns and suggests your favorite aliases over time.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/rdVH8FpKe6k"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Kite continues to tap into Jupyter kernel completions, which are useful when you need to access attributes such as columns on a DataFrame. With Kite, these kernel completions now show up automatically as you type.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vochw5xY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/08/jlab-kite-kernal-completion-for-dataframe-Screenshot-2020-07-17-03.59.29.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vochw5xY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/08/jlab-kite-kernal-completion-for-dataframe-Screenshot-2020-07-17-03.59.29.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Save time searching for Python docs with Kite’s Copilot desktop app. View Python docs with just one click or mouse-hover, plus find helpful examples and how-tos.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Uc5_6LjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/07/Seaborn-heatmap-Copilot-Docs-LIGHT-1-Screenshot-2020-07-16-16.43.50.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Uc5_6LjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/07/Seaborn-heatmap-Copilot-Docs-LIGHT-1-Screenshot-2020-07-16-16.43.50.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More features you’ll get with Kite in JupyterLab:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kite’s models work locally and independently of your Python kernel. This means if your kernel’s busy reading in data, you‘ll still get Kite completions while coding in other cells. Plus, no code is sent to a cloud server for processing.&lt;/li&gt;
&lt;li&gt;Kite works in .py files within JupyterLab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kite for JupyterLab comes in a Free and a &lt;a href="https://www.kite.com/pro/"&gt;Pro&lt;/a&gt; version (free 30-day trial), and works 100% locally. You can &lt;a href="https://www.kite.com/download/"&gt;download Kite here&lt;/a&gt;. Follow the instructions &lt;a href="https://help.kite.com/article/143-how-to-install-the-jupyterlab-plugin"&gt;here&lt;/a&gt; to install the JupyterLab plugin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kite makes coding with Python faster and more enjoyable
&lt;/h2&gt;

&lt;p&gt;We’ve trained Kite’s deep learning models on over 25 million open-source Python files to ensure Kite works with your favorite libraries. With how fast data science tooling evolves, it’s critical to stay on top of new modules and APIs, and Kite’s completions help make that easier to do.&lt;/p&gt;

&lt;p&gt;Kite’s deep learning models have learned the most popular patterns used by data scientists, plus they understand the context of your code. This means Kite can predict relevant chunks of code and put them in your completions. This can be useful in three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you already know what you need to type, Kite helps you jump ahead to the next task.&lt;/li&gt;
&lt;li&gt;If you’re having trouble remembering a calculation or code pattern, Kite can remind you so you don’t need to search on Google.&lt;/li&gt;
&lt;li&gt;If you have never used a module or function before, you can get documentation faster with the &lt;a href="https://www.kite.com/copilot/"&gt;Kite Copilot&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  JupyterHub: Boost the whole team’s productivity with Kite
&lt;/h2&gt;

&lt;p&gt;Does your team use JupyterHub? We offer additional features for JupyterHub teams:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy Kite on your JupyterHub server to instantly bring AI-powered completions and one-click documentation to the whole team.&lt;/li&gt;
&lt;li&gt;Add Kite’s largest ML models to a GPU-powered server for smarter, longer completions.&lt;/li&gt;
&lt;li&gt;Custom-tailor Kite’s models to your team’s codebase and APIs.&lt;/li&gt;
&lt;li&gt;Manage Kite licenses and billing through a unified system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Email &lt;a href="mailto:sales@kite.com"&gt;sales@kite.com&lt;/a&gt; to set up a demo and get extended free trials of Kite Pro for your whole team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you, Jupyter community!
&lt;/h2&gt;

&lt;p&gt;This plugin would not be possible without the guidance of the Jupyter community and JupyterLab’s development team. In partnership with &lt;a href="https://www.quansight.com/labs"&gt;Quansight Labs&lt;/a&gt;, we worked with the JupyterLab development team to contribute to the Jupyter completions API and completions interface via four PRs and 87 commits (here are &lt;a href="https://github.com/jupyterlab/jupyterlab/pull/8080"&gt;two&lt;/a&gt; &lt;a href="https://github.com/jupyterlab/jupyterlab/pull/8141"&gt;examples&lt;/a&gt;). These improvements enable others in the Jupyter community to more easily build plugins for JupyterLab.&lt;/p&gt;

&lt;p&gt;We will continue working with the community to help JupyterLab evolve and remain a powerful option for data scientists and developers.&lt;/p&gt;

&lt;p&gt;We hope you’ll give our completions a spin in your next JupyterLab session by &lt;a href="https://www.kite.com/download/"&gt;downloading Kite here&lt;/a&gt; and &lt;a href="https://help.kite.com/article/143-how-to-install-the-jupyterlab-plugin"&gt;installing the JupyterLab plugin&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Happy Coding,&lt;/p&gt;

&lt;p&gt;The Kite Team&lt;/p&gt;

&lt;p&gt;P.S. If you are a university student you can get Kite Pro for free by signing up with your school email address (&lt;a href="https://help.kite.com/article/135-free-university-licenses-for-kite-pro"&gt;instructions&lt;/a&gt;). And we’ll be expanding student access to high schoolers and others soon, just in time for the fall semester.&lt;/p&gt;

</description>
      <category>python</category>
      <category>devtips</category>
      <category>startup</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Kite Launches AI-Powered JavaScript Completions</title>
      <dc:creator>brendan</dc:creator>
      <pubDate>Tue, 12 May 2020 17:21:30 +0000</pubDate>
      <link>https://dev.to/kite/kite-launches-ai-powered-javascript-completions-2nje</link>
      <guid>https://dev.to/kite/kite-launches-ai-powered-javascript-completions-2nje</guid>
      <description>&lt;p&gt;Today we’re excited to launch Kite’s AI-powered completions for JavaScript. Kite’s completions automate away the repetitive boilerplate of writing JavaScript code.&lt;/p&gt;

&lt;p&gt;Let’s take a look…&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/eL59wqFu31o"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Now let’s break it down…&lt;/p&gt;

&lt;p&gt;Kite can complete up to multiple lines of code at a time, reducing the time you spend writing repetitive code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ozsr-Xp9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s8itb6mt2vu7u1m48bbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ozsr-Xp9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s8itb6mt2vu7u1m48bbm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kite is able to provide completions when editors like VS Code cannot understand the code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XHwI5I2h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/Kite_understands_more_code_than_editor_light.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XHwI5I2h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/Kite_understands_more_code_than_editor_light.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kite shows completions in more situations, for example after a space.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nMLKYGMm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/Kite_works_after_space_sm_light.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nMLKYGMm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/Kite_works_after_space_sm_light.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kite works alongside your editor’s completions. We use carefully-designed filters to reduce noise.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hXTAe45i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/Kite_works_alongside_editor_light.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hXTAe45i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/Kite_works_alongside_editor_light.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ve trained a new deep learning model on 22 million open-source JavaScript files to ensure Kite works with your favorite libraries and frameworks like &lt;strong&gt;React, Vue, Angular,&lt;/strong&gt; and &lt;strong&gt;Node.js.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kite for JavaScript is free and works 100% locally.&lt;/strong&gt; You can &lt;a href="https://www.kite.com/download/"&gt;download it here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kite makes coding faster and easier
&lt;/h2&gt;

&lt;p&gt;The JavaScript ecosystem continually invents new frameworks and design patterns. These inventions make it a vibrant place to be, but it also creates the need to learn an ever-changing set of code patterns and APIs.&lt;/p&gt;

&lt;p&gt;Kite’s deep learning models have learned all of these patterns, and understand the context of your code, so Kite can predict chunks of code and put them in your completions. This can be useful in two ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you already know what you need to type, Kite helps you jump ahead to the next task.&lt;/li&gt;
&lt;li&gt;If you’re having trouble remembering an API or design pattern, Kite can remind you so you don’t need to search on Google.
As a result, writing JavaScript with Kite becomes faster and more fun.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  We’re just getting started
&lt;/h2&gt;

&lt;p&gt;Kite can help you ship software faster today.&lt;/p&gt;

&lt;p&gt;And we’re just getting started. We believe that machine learning can automate away the tedious parts of writing code, and there’s so much more to do. We’re continually exploring ways ML can unlock productivity gains for developers, and we hope that you will join us.&lt;/p&gt;

&lt;h2&gt;
  
  
  A big thanks to the 250,000 developers who use Kite
&lt;/h2&gt;

&lt;p&gt;We’re thrilled to share today that over 250,000 people are coding with Kite every month. We feel grateful to have reached this milestone, and we’d like to thank everyone who uses Kite. This amazing progress wouldn’t be possible without each of you giving us the encouragement and feedback that fuels the hard work — 30,000 code commits to date — that got us here.&lt;/p&gt;

&lt;p&gt;We hope you’ll join us on this journey by &lt;a href="//kite.com/download"&gt;downloading Kite&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Happy coding,&lt;/p&gt;

&lt;p&gt;The Kite Team&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ouP_YEmf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/kite-signatures-javascript-launch-blog-post.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ouP_YEmf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.kite.com/wp-content/uploads/2020/05/kite-signatures-javascript-launch-blog-post.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt; We are also announcing Kite Pro today, which is our first paid product for Python professionals. Check out our &lt;a href="https://www.kite.com/blog/product/kite-introduces-paid-plan-kite-pro"&gt;separate blog post&lt;/a&gt; about Kite Pro for more info!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>devtips</category>
      <category>startup</category>
      <category>react</category>
    </item>
    <item>
      <title>Building a Push-Up Bot in Discord!</title>
      <dc:creator>Jillian Stenzel</dc:creator>
      <pubDate>Mon, 27 Apr 2020 14:26:43 +0000</pubDate>
      <link>https://dev.to/kite/building-a-push-up-bot-in-discord-235</link>
      <guid>https://dev.to/kite/building-a-push-up-bot-in-discord-235</guid>
      <description>&lt;p&gt;With covid-19 getting us all out of shape, we decided a push-up bot was in order. In this 10 minute tutorial, we walk you through how to build a bot in discord. &lt;/p&gt;

&lt;p&gt;Hope you all enjoy this one day build. Now drop and give me 20! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=etSRnPp9H8s&amp;amp;t=18s"&gt;https://www.youtube.com/watch?v=etSRnPp9H8s&amp;amp;t=18s&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>python</category>
      <category>100daysofcode</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Visualization of the biggest code bases (using blender3d and data from dataisbeautiful)</title>
      <dc:creator>Jason G</dc:creator>
      <pubDate>Fri, 10 Apr 2020 23:15:28 +0000</pubDate>
      <link>https://dev.to/kite/visualization-of-the-biggest-code-bases-using-blender3d-and-data-from-dataisbeautiful-4efk</link>
      <guid>https://dev.to/kite/visualization-of-the-biggest-code-bases-using-blender3d-and-data-from-dataisbeautiful-4efk</guid>
      <description>&lt;p&gt;Maybe a bit too far with the zooming, will be better next time!&lt;br&gt;
Youtube - &lt;a href="https://www.youtube.com/watch?v=afEg6VuAQJQ"&gt;https://www.youtube.com/watch?v=afEg6VuAQJQ&lt;/a&gt;&lt;br&gt;
Data - &lt;a href="https://docs.google.com/spreadsheets/d/1s9u0uprmuJvwR2fkRqxJ4W5Wfomimmk9pwGTK4Dn_UI/edit#gid=5"&gt;https://docs.google.com/spreadsheets/d/1s9u0uprmuJvwR2fkRqxJ4W5Wfomimmk9pwGTK4Dn_UI/edit#gid=5&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>python</category>
    </item>
    <item>
      <title>Beautiful timeline animation of the biggest code bases in history</title>
      <dc:creator>Jillian Stenzel</dc:creator>
      <pubDate>Thu, 09 Apr 2020 20:20:37 +0000</pubDate>
      <link>https://dev.to/kite/beautiful-timeline-animation-of-the-biggest-code-bases-in-history-3kkd</link>
      <guid>https://dev.to/kite/beautiful-timeline-animation-of-the-biggest-code-bases-in-history-3kkd</guid>
      <description>&lt;p&gt;From 1970 to today, we made a visualization of the largest code bases in history- animated on a timeline, measured in lines of code. &lt;/p&gt;

&lt;p&gt;May this serve as a little devinspo for you today! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=afEg6VuAQJQ&amp;amp;t=1s"&gt;https://www.youtube.com/watch?v=afEg6VuAQJQ&amp;amp;t=1s&lt;/a&gt; &lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>100daysofcode</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Data structures can make or break your coding interview</title>
      <dc:creator>Jillian Stenzel</dc:creator>
      <pubDate>Sat, 04 Apr 2020 16:18:07 +0000</pubDate>
      <link>https://dev.to/kite/data-structures-can-make-or-break-your-coding-interview-257n</link>
      <guid>https://dev.to/kite/data-structures-can-make-or-break-your-coding-interview-257n</guid>
      <description>&lt;p&gt;Understanding data structures is a key skill for being a software engineer, so it makes sense that you can expect to use them in your technical interviews. Often times, using the correct data structure can make the difference in getting the job or not. &lt;/p&gt;

&lt;p&gt;We made a video on some key data structures you need to know for your code interviews, including examples of when you should use each data structure and a links to them in Leetcode for practice. &lt;/p&gt;

&lt;p&gt;This tutorial goes into...&lt;/p&gt;

&lt;p&gt;Arrays&lt;br&gt;
Linked lists&lt;br&gt;
Stacks/queues &lt;br&gt;
Hash tables&lt;br&gt;
Heaps&lt;br&gt;
Binary trees&lt;/p&gt;

&lt;p&gt;Happy coding! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=K_ZuEy9_W_E"&gt;https://www.youtube.com/watch?v=K_ZuEy9_W_E&lt;/a&gt; &lt;/p&gt;

</description>
      <category>datascience</category>
      <category>python</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
    <item>
      <title>Quick guide to sorting algorithms + fastest comparison sort!</title>
      <dc:creator>Jillian Stenzel</dc:creator>
      <pubDate>Fri, 27 Mar 2020 21:58:07 +0000</pubDate>
      <link>https://dev.to/kite/quick-guide-to-sorting-algorithms-fastest-comparison-sort-1eho</link>
      <guid>https://dev.to/kite/quick-guide-to-sorting-algorithms-fastest-comparison-sort-1eho</guid>
      <description>&lt;p&gt;We made a video breaking down comparison sorts into three levels: N^2, N log N, &amp;amp; hybrid algorithms + a fun animation comparing the algorithms to see which one is the fastest! &lt;/p&gt;

&lt;p&gt;After watching, you should have a better understanding of the different types of sorting algorithms as well as the benefits and drawbacks of each and when to use them. Enjoy! &lt;a href="https://www.youtube.com/watch?v=qk7b4-iyCJ4"&gt;https://www.youtube.com/watch?v=qk7b4-iyCJ4&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;While you're add it, brush up on your interview skills with our top tips for technical interviews in Python: &lt;a href="https://www.youtube.com/watch?v=Zee665ssm8Y&amp;amp;t=13s"&gt;https://www.youtube.com/watch?v=Zee665ssm8Y&amp;amp;t=13s&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>database</category>
      <category>datascience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Trying to make better quality Python videos and looking for feedback! Here's one of our first videos on Web Scraping and SQLite</title>
      <dc:creator>Jason G</dc:creator>
      <pubDate>Fri, 21 Feb 2020 20:14:19 +0000</pubDate>
      <link>https://dev.to/kite/trying-to-make-better-quality-python-videos-and-looking-for-feedback-here-s-one-of-our-first-videos-on-web-scraping-and-sqlite-26am</link>
      <guid>https://dev.to/kite/trying-to-make-better-quality-python-videos-and-looking-for-feedback-here-s-one-of-our-first-videos-on-web-scraping-and-sqlite-26am</guid>
      <description>&lt;p&gt;There's quite a lot of content on Youtube for Python and we've all likely skipped through many videos with bad audio or really small font trying to find an answer to a problem. We want to make better quality and more entertaining content for Python, so we'd really appreciate any feedback on the videos we've made so far, suggestions on what topics you would like us to cover or just your thoughts in general about developer content on Youtube.&lt;/p&gt;

&lt;p&gt;Here are the links to our first couple videos.&lt;br&gt;
Web Scraping - &lt;a href="https://www.youtube.com/watch?v=ogPMCpcgb-E"&gt;https://www.youtube.com/watch?v=ogPMCpcgb-E&lt;/a&gt;&lt;br&gt;
SQLite - &lt;a href="https://www.youtube.com/watch?v=girsuXz0yA8"&gt;https://www.youtube.com/watch?v=girsuXz0yA8&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some Feedback so far&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;better audio levels&lt;/li&gt;
&lt;li&gt;more depth into a topic&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>discuss</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Announcing the Kite Integration for Spyder</title>
      <dc:creator>brendan</dc:creator>
      <pubDate>Tue, 10 Dec 2019 00:26:12 +0000</pubDate>
      <link>https://dev.to/kite/announcing-the-kite-integration-for-spyder-2lb1</link>
      <guid>https://dev.to/kite/announcing-the-kite-integration-for-spyder-2lb1</guid>
      <description>&lt;p&gt;We’re thrilled to announce Kite’s Python integration for &lt;a href="https://www.spyder-ide.org/"&gt;Spyder&lt;/a&gt;, the popular open-source IDE for scientists, engineers, and data analysts. Kite is now available as a free Python code completions option for all Spyder users as part of the &lt;a href="https://github.com/spyder-ide/spyder/releases"&gt;Spyder 4 release&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Spyder users can use Kite’s machine learning models to get more and better completions while coding with &lt;a href="https://www.scipy.org/"&gt;PyData&lt;/a&gt; libraries (e.g. NumPy, SciPy, Pandas, and Matplotlib). These libraries previously had minimal autocomplete support due to type analysis limitations of the completions engine Spyder used to exclusively rely on, called Jedi.&lt;/p&gt;

&lt;p&gt;Kite worked alongside Spyder’s core contributors to incorporate several autocomplete improvements in the Spyder 4 release. This collaboration happened through Quansight’s &lt;a href="https://labs.quansight.org/blog/2019/05/community-driven-opensource-funded-development/"&gt;Community Work Order program&lt;/a&gt;, a new framework for private companies to partner with open source projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Kite can be selected as a free code completions option in Spyder 4. Download and install Spyder 4 via &lt;a href="https://www.anaconda.com/download/"&gt;Anaconda&lt;/a&gt; or via &lt;a href="https://github.com/spyder-ide/spyder/releases"&gt;Spyder’s Github repo&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Spyder users will see autocomplete improvements when enabling Kite, including faster and more useful completions for numerics libraries. Watch an overview video about Kite for Spyder on our &lt;a href="https://youtu.be/yYMCAhKt2pg"&gt;YouTube channel&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Kite’s &lt;a href="https://kite.com/blog/product/announcing-intelligent-snippets-for-python/"&gt;Intelligent Snippets&lt;/a&gt;, &lt;a href="https://kite.com/blog/product/launching-line-of-code-completions-going-cloudless-and-17-million-in-funding/"&gt;Line-of-Code Completions&lt;/a&gt;, Dictionary Key Completions, and &lt;a href="https://kite.com/copilot/"&gt;Copilot&lt;/a&gt; desktop app are all supported for Spyder users. &lt;/li&gt;
&lt;li&gt;As with Kite’s other editor integrations, all code processing happens locally without leaving the user’s computer.&lt;/li&gt;
&lt;li&gt;Kite and the Spyder core contributors worked together on this integration via Quansight’s &lt;a href="https://labs.quansight.org/blog/2019/05/community-driven-opensource-funded-development/"&gt;Community Work Order program&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You'll need to have Kite installed on your computer to enable our Spyder integration. Download Kite &lt;a href="//kite.com/download"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting more completions, more often for numerics libraries in Spyder
&lt;/h2&gt;

&lt;p&gt;Spyder users have &lt;a href="https://github.com/spyder-ide/spyder/issues/5782"&gt;long reported&lt;/a&gt; issues with the completions for numerics libraries. This was largely due to type analysis limitations in the Jedi completions engine. It had difficulty analyzing third-party libraries for scientific computing (e.g. NumPy, SciPy, TensorFlow, etc.) that make use of compiled extensions. Without good type analysis, generating completions is inaccurate and resource intensive.&lt;/p&gt;

&lt;p&gt;Enabling Kite in Spyder solves this problem, and goes beyond in a number of ways. Kite’s ML engine generates multi-token completions, and returns completions much faster.&lt;/p&gt;

&lt;p&gt;To enable Kite in Spyder, go to Preferences/ Settings -&amp;gt; click on Completion and Linting -&amp;gt; click on the “Advanced” tab -&amp;gt; click “Enable Kite” under Providers -&amp;gt; click “Apply”.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r15F-ZhX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zksll8s60fy1wriu2gso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r15F-ZhX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zksll8s60fy1wriu2gso.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Kite’s smarter completions features
&lt;/h2&gt;

&lt;p&gt;Kite also features Line-of-Code Completions, Intelligent Snippets, and recently released, Dictionary Key Completions – all of which save you time and hassle while coding.&lt;/p&gt;

&lt;p&gt;Line-of-Code Completions are multi-token completions for the top 100 Python libraries that are unique to Kite’s machine learning engine. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XzzMr1-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0jhaozll7h46ymvxq498.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XzzMr1-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0jhaozll7h46ymvxq498.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Intelligent Snippets allow you to complete complex, multi-token statements with ease by generating context-relevant code snippets as you type. Whereas editor snippets typically must be manually defined in advance, Kite’s Intelligent Snippets are generated in real-time based on the code patterns Kite finds in your codebase.&lt;/p&gt;

&lt;p&gt;Dictionary Key Completions save you time by remembering the structure of dictionary objects in your codebase. These completions work for integer keys as well as string keys, the latter of which can be tedious to recall and prone to typos. Check out examples and a more detailed description of this new feature in our December release notes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improving completions performance in Spyder
&lt;/h2&gt;

&lt;p&gt;Enabling Kite results in faster completions in Spyder for two main reasons. First, the Spyder and Kite teams worked together to make performance optimizations to reduce completions lag for Spyder 4. Second, Kite’s ML engine is continually optimized to show smarter completions, faster.&lt;/p&gt;

&lt;p&gt;At Kite we invest in routine optimization of application and ML model performance to limit impact on users’ CPU and memory resources. For instance, Kite intelligently caches index builds based on whether your Python files have changed recently. It also only loads parts of its ML engine based on whether relevant libraries are used in users’ codebases. So if you’re only using numerics libraries, only relevant parts of the Kite engine will be running to conserve resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Did we mention one-click docs search?
&lt;/h2&gt;

&lt;p&gt;Another nice perk of enabling Kite is access to Kite’s Copilot app and one-click docs search within Spyder. Check out the Kite Copilot &lt;a href="https://kite.com/copilot/"&gt;here&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leveraging Quansight’s Community Work Order
&lt;/h2&gt;

&lt;p&gt;Quansight’s &lt;a href="https://labs.quansight.org/blog/2019/05/community-driven-opensource-funded-development/"&gt;Community Work Order (CWO)&lt;/a&gt; was an ideal framework to collaborate with the Spyder core contributors on improving the completions experience, a feature which had been the center of a lot of &lt;a href="https://github.com/spyder-ide/spyder/issues/5782"&gt;user feedback&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Given all of the resources we’ve invested into completions intelligence at Kite, we saw a natural fit to work with the Spyder team to improve Spyder’s completions infrastructure and get AI-powered completions in the hands of more developers for free.&lt;/p&gt;

&lt;p&gt;However, structuring projects between open source communities and private companies is challenging across a number of dimensions: What work should be done? Who does the work? How long will it take? Where does the funding come from and what is it spent on? Quansight’s CWO provided transparency for how to fund and structure a partnership of this nature. &lt;a href="https://labs.quansight.org/blog/2019/05/community-driven-opensource-funded-development/"&gt;Read more about the principles of CWOs on Quansight’s blog.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The CWO we sponsored provided funds for the development hours needed to improve the completions experience for Spyder 4. Additionally, Kite engineers and product managers contributed hours towards &lt;a href="https://github.com/spyder-ide/spyder/pull/10502"&gt;performance improvements&lt;/a&gt; and debugging efforts within the Spyder codebase.&lt;/p&gt;

&lt;p&gt;We enjoyed contributing to the Spyder 4 release, and we look forward to collaborating on ongoing efforts with the Spyder community to support free completions!&lt;/p&gt;

&lt;p&gt;Share the news on Twitter with @Spyder_IDE and @KiteHQ. Download Kite &lt;a href="//kite.com/download"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>devtips</category>
      <category>datascience</category>
      <category>startup</category>
    </item>
    <item>
      <title>[Video] Python Decorators in 15 Minutes</title>
      <dc:creator>brendan</dc:creator>
      <pubDate>Thu, 31 Oct 2019 18:16:58 +0000</pubDate>
      <link>https://dev.to/kite/video-python-decorators-in-15-minutes-5l3</link>
      <guid>https://dev.to/kite/video-python-decorators-in-15-minutes-5l3</guid>
      <description>&lt;p&gt;Decorators are an advanced feature of the Python language that allow you to modify the behavior of a function or method without touching its code. This video will teach you why decorators work and how to create your own. It will also walk through a few examples to give you a better idea of where to use Python decorators.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/r7Dtus7N4pI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Want to try Kite? You can download it for free &lt;a href="https://kite.com/download/?utm_medium=referral&amp;amp;utm_source=youtube&amp;amp;utm_campaign=kite&amp;amp;utm_content=python-decorators"&gt;here&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>devtips</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Choosing an Autocomplete for Python</title>
      <dc:creator>brendan</dc:creator>
      <pubDate>Wed, 30 Oct 2019 17:16:38 +0000</pubDate>
      <link>https://dev.to/kite/choosing-an-autocomplete-for-python-365b</link>
      <guid>https://dev.to/kite/choosing-an-autocomplete-for-python-365b</guid>
      <description>&lt;p&gt;Using a code completion engine helps you remember syntax and write code faster. There are two main options around today for autocomplete in Python: Jedi and Kite. They both integrate with all the most popular IDEs for Python This video outlines why you should be using an autocomplete plugin while you code and how to choose the right completion engine for you.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Qa-5mYCqPto"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Want to try Kite? You can download it for free &lt;a href="https://kite.com/download/?utm_medium=referral&amp;amp;utm_source=youtube&amp;amp;utm_campaign=kite&amp;amp;utm_content=choosing-an-autocomplete-for-python"&gt;here&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>devtips</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Django Database Migrations: A Comprehensive Overview</title>
      <dc:creator>Aaron Harris</dc:creator>
      <pubDate>Wed, 23 Oct 2019 19:30:55 +0000</pubDate>
      <link>https://dev.to/kite/django-database-migrations-a-comprehensive-overview-5dk8</link>
      <guid>https://dev.to/kite/django-database-migrations-a-comprehensive-overview-5dk8</guid>
      <description>&lt;p&gt;Django Database Migrations: A Comprehensive Overview&lt;br&gt;
&lt;em&gt;by Damian Hites&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The Django web framework is designed to work with an SQL-based relational database backend, most commonly  PostgreSQL or MySQL. If you’ve never worked directly with a relational database before, managing how your data is stored/accessed and keeping it consistent with your application code is an important skill to master. &lt;/p&gt;

&lt;p&gt;You’ll need a contract between your database schema (how your data is laid out in your database) and your application code, so that when your application tries to access data, the data is where your application expects it to be. Django provides an abstraction for managing this contract in its ORM (Object-Relational Mapping). &lt;/p&gt;

&lt;p&gt;Over your application’s lifetime, it’s very likely that your data needs will change. When this happens, your database schema will probably need to change as well. Effectively, your contract (in Django’s case, your Models) will need to change to reflect the new agreement, and before you can run the application, the database will need to be migrated to the new schema. &lt;/p&gt;

&lt;p&gt;Django’s ORM comes with a system for managing these migrations to simplify the process of keeping your application code and your database schema in sync.&lt;/p&gt;
&lt;h2&gt;
  
  
  Django’s database migration solution
&lt;/h2&gt;

&lt;p&gt;Django’s migration tool simplifies the manual nature of the migration process described above while taking care of tracking your migrations and the state of your database. Let’s take a look at the three-step migration process with Django’s migration tool.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Change the contract: Django’s ORM
&lt;/h3&gt;

&lt;p&gt;In Django, the contract between your database schema and your application code is defined using the Django ORM. You define a data model using Django ORM’s models and your application code interfaces with that data model. &lt;/p&gt;

&lt;p&gt;When you need to add data to the database or change the way the data is structured, you simply create a new model or modify an existing model in some way. Then you can make the required changes to your application code and update your unit tests, which should verify your new contract (if given enough testing coverage).&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Plan for change: generate migrations
&lt;/h3&gt;

&lt;p&gt;Django maintains the contract largely through its migration tool. Once you make changes to your models, Django has a simple command that will detect those changes and generate migration files for you.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Execute: apply migrations
&lt;/h3&gt;

&lt;p&gt;Finally, Django has another simple command that will apply any unapplied migrations to the database. Run this command any time you are deploying your code to the production environment. Ideally, you’ll have deploy scripts that would run the migration command right before pushing your new code live.&lt;/p&gt;
&lt;h3&gt;
  
  
  Tracking changes with Django
&lt;/h3&gt;

&lt;p&gt;Django takes care of tracking migrations for you. Each generated migration file has a unique name that serves as an identifier. When a migration is applied, Django maintains a database table for tracking applied migrations to make sure that only unapplied migrations are run. &lt;/p&gt;

&lt;p&gt;The migration files that Django generates should be included in the same commit with their corresponding application code so that it’s never out-of-sync with your database schema.&lt;/p&gt;
&lt;h3&gt;
  
  
  Rolling back with Django
&lt;/h3&gt;

&lt;p&gt;Django has the ability to rollback to a previous migration. The auto-generated operations feature built-in support for reversing an operation. In the case of a custom operation, it’s on you to make sure the operation can be reversed to ensure that this functionality is always available.&lt;/p&gt;
&lt;h2&gt;
  
  
  A simple Django database migrations example
&lt;/h2&gt;

&lt;p&gt;Now that we have a basic understanding of how migrations are handled in Django, let’s look at a simple example of migrating an application from one state to the next. Let’s assume we have a Django project for our blog and we want to make some changes. &lt;/p&gt;

&lt;p&gt;First, we want to allow for our posts to be edited before publishing to the blog. Second, we want to allow people to give feedback on each post, but we want to give them a curated list of options for that feedback. In anticipation of those options changing, we want to define them in our database rather than in the application code.&lt;/p&gt;
&lt;h3&gt;
  
  
  The initial Django application
&lt;/h3&gt;

&lt;p&gt;For the purposes of demonstration, we’ll setup a very basic Django project called &lt;code&gt;Foo&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django-admin startproject foo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Within that project, we’ll set up our blogging application. From inside the project’s base directory: &lt;code&gt;./manage.py startapp blog&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Register our new application with our project in &lt;code&gt;foo/settings.py&lt;/code&gt; by adding &lt;code&gt;blog&lt;/code&gt; to &lt;code&gt;INSTALLED_APPS&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;INSTALLED_APPS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
    &lt;span class="s"&gt;'blog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;blog/models.py&lt;/code&gt; we can define our initial data model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SlugField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In our simple application, the only model we have represents a blog post. It has a slug for uniquely identifying the post, a title, and the body of the post.&lt;/p&gt;

&lt;p&gt;Now that we have our initial data model defined, we can generate the migrations that will set up our database: &lt;code&gt;./manage.py makemigrations&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Notice that the output of this command indicates that a new migration file was created at&lt;/p&gt;

&lt;p&gt;&lt;code&gt;blog/migrations/0001_initial.py&lt;/code&gt; containing a command to &lt;code&gt;CreateModel name=‘Post’&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;If we open the migration file, it will look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Generated by Django 2.2 on 2019-04-21 18:04
&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;django.db&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;initial&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;

    &lt;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;operations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'Post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AutoField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;auto_created&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                    &lt;span class="n"&gt;primary_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                    &lt;span class="n"&gt;serialize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                    &lt;span class="n"&gt;verbose_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'ID'&lt;/span&gt;
                &lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'slug'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SlugField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'title'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'body'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Most of the migration’s contents are pretty easy to make sense of. This initial migration was auto-generated, has no dependencies, and has a single operation: create the &lt;code&gt;Post Model&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now let’s set up an initial SQLite database with our data model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./manage.py migrate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The default Django configuration uses SQLite3, so the above command generates a file called &lt;code&gt;db.sqlite3&lt;/code&gt; in your project’s root directory. Using the SQLite3 command line interface, you can inspect the contents of the database and of certain tables. &lt;/p&gt;

&lt;p&gt;To enter the SQLite3 command line tool run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;sqlite3&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sqlite3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Once in the tool, list all tables generated by your initial migration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;sqlite&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tables&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Django comes with a number of initial models that will result in database tables, but the 2 that we care about right now are &lt;code&gt;blog_post&lt;/code&gt;, the table corresponding to our &lt;code&gt;Post Model&lt;/code&gt;, and &lt;code&gt;django_migrations&lt;/code&gt;, the table Django uses to track migrations. &lt;/p&gt;

&lt;p&gt;Still in the SQLite3 command line tool, you can print the contents of the &lt;code&gt;django_migrations&lt;/code&gt; table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;sqlite&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django_migrations&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will show all migrations that have run for your application. If you look through the list, you’ll find a record indicating that the &lt;code&gt;0001_initial migration&lt;/code&gt; was run for the blog application. This is how Django knows that your migration has been applied.&lt;/p&gt;

&lt;h3&gt;
  
  
  Changing the Django data model
&lt;/h3&gt;

&lt;p&gt;Now that the initial application is setup, let’s make changes to the data model. First, we’ll add a field called &lt;code&gt;published_on&lt;/code&gt; to our &lt;code&gt;Post Model&lt;/code&gt;. This field will be nullable. When we want to publish something, we can simply indicate when it was published. &lt;/p&gt;

&lt;p&gt;Our new &lt;code&gt;Post Model&lt;/code&gt; will now be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;django.db&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SlugField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;published_on&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DateTimeField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;null&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;blank&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next, we want to add support for accepting feedback on our posts. We want 2 models here: one for tracking the options we display to people, and one for tracking the actual responses&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;django.conf&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;django.db&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FeedbackOption&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SlugField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PostFeedback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AUTH_USER_MODEL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'feedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s"&gt;'Post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'feedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s"&gt;'FeedbackOption'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'feedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Generate the Django database migration
&lt;/h3&gt;

&lt;p&gt;With our model changes done, let’s generate our new migrations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./manage.py makemigrations
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Notice that this time, the output indicates a new migration file, &lt;code&gt;blog/migrations/0002_auto_&amp;lt;YYYYMMDD&amp;gt;_&amp;lt;...&amp;gt;.py&lt;/code&gt;, with the following changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create model &lt;code&gt;FeedbackOption&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add field &lt;code&gt;published_on&lt;/code&gt; to &lt;code&gt;Post&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create model &lt;code&gt;PostFeedback&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the three changes that we introduced to our data model. &lt;/p&gt;

&lt;p&gt;Now, if we go ahead and open the generated file, it will look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Generated by Django 2.2 on 2019-04-21 19:31
&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;django.conf&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;django.db&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;django.db.models.deletion&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;swappable_dependency&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AUTH_USER_MODEL&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'blog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'0001_initial'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;operations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'FeedbackOption'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AutoField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;auto_created&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;primary_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;serialize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'ID'&lt;/span&gt;
                &lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'slug'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SlugField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'option'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'published_on'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;field&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DateTimeField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;blank&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;null&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;migrations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'PostFeedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AutoField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;auto_created&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;primary_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;serialize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;verbose_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'ID'&lt;/span&gt;
                &lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'option'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deletion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'feedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'blog.FeedbackOption'&lt;/span&gt;
                &lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deletion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'feedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'blog.Post'&lt;/span&gt;
                &lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deletion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'feedback'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AUTH_USER_MODEL&lt;/span&gt;
                &lt;span class="p"&gt;)),&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Similar to our first migration file, each operation maps to changes that we made to the data model. The main differences to note are the dependencies. Django has detected that our change relies on the first migration in the blog application and, since we depend on the auth user model, that is marked as a dependency as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  Applying the Django database migration
&lt;/h3&gt;

&lt;p&gt;Now that we have our migrations generated, we can apply the migrations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./manage.py migrate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The output tells us that the latest generated migration is applied. If we inspect our modified SQLite database, we’ll see that our new migration file should be in the &lt;code&gt;django_migrations&lt;/code&gt; table, the new tables should be present, and our new field on the &lt;code&gt;Post Model&lt;/code&gt; should be reflected in the &lt;code&gt;blog_post&lt;/code&gt; table.&lt;/p&gt;

&lt;p&gt;Now, if we were to deploy our changes to production, the application code and database  would be updated, and we would be running the new version of our application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus: data migrations
&lt;/h3&gt;

&lt;p&gt;In this particular example, the &lt;code&gt;blog_feedbackoption&lt;/code&gt; table (generated by our migration) will be empty when we push our code change. If our interface has been updated to surface these options, there is a chance that we forget to populate these when we push. Even if we don’t forget, we have the same problem as before: new objects are created in the database while the new application code is deploying, so there is very little time for the interface to show a blank list of options. &lt;/p&gt;

&lt;p&gt;To help in scenarios where the required data is somewhat tied to the application code or to changes in the data model, Django provides utility for making data migrations. These are migration operations that simply change the data in the database rather than the table structure.&lt;/p&gt;

&lt;p&gt;Let’s say we want to have the following feedback options: Interesting, Mildly Interesting, Not Interesting and Boring. We could put our data migration in the same migration file that we generated previously, but let’s create another migration file specifically for this data migration...&lt;/p&gt;

&lt;p&gt;... &lt;em&gt;check out &lt;a href="https://kite.com/blog/python/django-database-migrations-overview/"&gt;the code on Kite's blog&lt;/a&gt;! Continue with "Bonus: Data Migrations"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Damian Hites is the CTO of Sylo, which is looking to improve Social Media Marketing by offering 3rd party trusted&lt;/em&gt; &lt;em&gt;measurement. He has 10+ years of experience writing software and leading teams.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
