<?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: Israjur Rahman</title>
    <description>The latest articles on DEV Community by Israjur Rahman (@israjurrahman).</description>
    <link>https://dev.to/israjurrahman</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%2Fuser%2Fprofile_image%2F564373%2Fe1442b26-e394-4d72-8cd8-c1008e0e92e6.jpg</url>
      <title>DEV Community: Israjur Rahman</title>
      <link>https://dev.to/israjurrahman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/israjurrahman"/>
    <language>en</language>
    <item>
      <title>How to Get Better Output from AI Tools (Without Burning Time and Tokens)</title>
      <dc:creator>Israjur Rahman</dc:creator>
      <pubDate>Mon, 06 Apr 2026 14:20:14 +0000</pubDate>
      <link>https://dev.to/israjurrahman/how-to-get-better-output-from-ai-tools-without-burning-time-and-tokens-1nbd</link>
      <guid>https://dev.to/israjurrahman/how-to-get-better-output-from-ai-tools-without-burning-time-and-tokens-1nbd</guid>
      <description>&lt;p&gt;Most engineers blame the AI when they get bad results. The real issue? The prompt.&lt;/p&gt;

&lt;p&gt;Here's what actually works:&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;1. Be specific upfront&lt;/strong&gt;&lt;br&gt;
Vague prompts = vague answers.&lt;br&gt;
❌ "Write a function to handle errors."&lt;br&gt;
✅ "Write a Python FastAPI middleware that catches async errors and returns a structured JSON response with status code and message."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Use constraints&lt;/strong&gt;&lt;br&gt;
Tell the AI what &lt;em&gt;not&lt;/em&gt; to do.&lt;br&gt;
"No comments. No print statements. Use async/await with httpx, not requests."&lt;br&gt;
Constraints cut bloat before it's even generated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Give an example&lt;/strong&gt;&lt;br&gt;
Point it to your existing code and say "match this style." Whether you're using Claude Code, Cursor, or GitHub Copilot, letting AI read your codebase directly means it aligns with your naming conventions, patterns, and architecture, no lengthy explanation needed. If you're on a browser-based AI, just paste a snippet, same idea, same result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Assign a role&lt;/strong&gt;&lt;br&gt;
"You are a senior backend engineer reviewing this API design for scalability issues."&lt;br&gt;
It steers the reasoning frame and gets you a sharper, more focused review.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Break complex tasks apart&lt;/strong&gt;&lt;br&gt;
Don't ask AI to "build a full auth system" in one prompt.&lt;br&gt;
Instead: models → routes → decorators/dependencies → pytest tests. Each step builds on the last and errors are easier to catch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Refine, don't regenerate&lt;/strong&gt;&lt;br&gt;
Something's off? Don't restart. Say:&lt;br&gt;
"This Python function is returning None instead of the parsed JSON, debug just this function, don't touch the rest."&lt;br&gt;
Targeted edits save tokens and preserve what's already working.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Control output length&lt;/strong&gt;&lt;br&gt;
"Give me 3 approaches to this caching problem, one paragraph each."&lt;br&gt;
Longer output ≠ better output. It just takes more time to read and review.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Know when AI can mislead you&lt;/strong&gt;&lt;br&gt;
Designing system architecture, making security-critical decisions, or estimating performance at scale, AI can sound very confident and still be completely wrong. Always validate its output with your own judgment and domain knowledge.&lt;/p&gt;




&lt;p&gt;The core principle?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI won't fix a bad brief. The quality of your output is directly proportional to the clarity of your input.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>programming</category>
      <category>promptengineering</category>
    </item>
    <item>
      <title>Some basic docker commands</title>
      <dc:creator>Israjur Rahman</dc:creator>
      <pubDate>Fri, 25 Jun 2021 09:56:24 +0000</pubDate>
      <link>https://dev.to/israjurrahman/some-basic-docker-commands-16dl</link>
      <guid>https://dev.to/israjurrahman/some-basic-docker-commands-16dl</guid>
      <description>&lt;p&gt;Some basic docker commands that will come handy when working with docker.&lt;/p&gt;

&lt;h4&gt;
  
  
  To build a docker project
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker-compose build&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To build &amp;amp; run docker project
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker-compose up&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To stop a docker project
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker-compose down&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To show docker image lists
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker images&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To remove a docker image
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker rmi &amp;lt;IMAGE ID&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To show only running containers
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker ps&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To show all containers
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker ps -a&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To show the latest created container
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker ps -l&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To display total file size of containers
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker ps -s&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To remove a container
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker rm &amp;lt;ID or NAME&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  To run django command in docker project
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker exec -it &amp;lt;CONTAINER ID&amp;gt; python manage.py migrate&lt;/code&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>django</category>
    </item>
    <item>
      <title>How to implement asynchronous socket status using django channels</title>
      <dc:creator>Israjur Rahman</dc:creator>
      <pubDate>Sat, 23 Jan 2021 09:04:16 +0000</pubDate>
      <link>https://dev.to/israjurrahman/how-to-implement-asynchronous-socket-status-using-django-channels-2804</link>
      <guid>https://dev.to/israjurrahman/how-to-implement-asynchronous-socket-status-using-django-channels-2804</guid>
      <description>&lt;p&gt;While developing an analytical project using django we came across an issue where we have to show status when our users start analysis. We decided to implement this using django channels. There are many tutorials about django channels on the internet but all of them are a little complex or using django channels to build a chat application. So I decided to write this article where I will show how to send asynchronous status to users using django channels.&lt;/p&gt;

&lt;p&gt;I am assuming you know at least the basics of django framework and how django works, so I am not going to show how to create a django project and django apps. I will directly start from implementing django channels.&lt;/p&gt;

&lt;p&gt;First we will start a project &lt;strong&gt;channelproj&lt;/strong&gt; and create an app &lt;strong&gt;notifier&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We need to install &lt;strong&gt;channels&lt;/strong&gt; and &lt;strong&gt;channels-redis&lt;/strong&gt; using pip :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install channels channels-redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to install redis-server to out system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install redis-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check redis-server status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F75ekxve9hzd5bgyo8cl8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F75ekxve9hzd5bgyo8cl8.png" alt="Redis Active Status" width="721" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we can see redis server is active and running on port 6379&lt;/p&gt;

&lt;p&gt;Then open django &lt;strong&gt;channelproj/settings.py&lt;/strong&gt; file and add channels and notifier to INSTALLED_APPS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'channels', # Here we added channels 
    'notifier' # we will use django channels in this app
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also need to add this lines in &lt;strong&gt;settings.py&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ASGI_APPLICATION = 'channelproj.asgi.application'

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": [("127.0.0.1", 6379)],
        },
    },
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To know more about channel layer click &lt;a href="https://channels.readthedocs.io/en/stable/topics/channel_layers.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we will create a file &lt;strong&gt;notifier/consumers.py&lt;/strong&gt; and add the following class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from channels.generic.websocket import AsyncJsonWebsocketConsumer

class StatusConsumer(AsyncJsonWebsocketConsumer):
    room_group_name = 'notify'

    async def connect(self):
        await self.channel_layer.group_add(
            self.room_group_name,
            self.channel_name
        )
        await self.accept()

    async def disconnect(self, code):
        await self.channel_layer.group_discard(
            self.room_group_name, 
            self.channel_layer
        )

    async def status_notifier(self, event):
        await self.send_json(event)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we are using &lt;strong&gt;AsyncJsonWebsocketConsumer&lt;/strong&gt; and creating a group named notify and we have defined a function called &lt;strong&gt;status_notifier&lt;/strong&gt; which will send all the events via socket url as json format.&lt;/p&gt;

&lt;p&gt;We will create another file &lt;strong&gt;notifier/routing.py&lt;/strong&gt; and add our socket urls&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.urls import path

from .consumers import StatusConsumer

ws_urlpatterns = [
    path('ws/status/', StatusConsumer.as_asgi())
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open &lt;strong&gt;channelproj/asgi.py&lt;/strong&gt; file and edit the file as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application

from notifier.routing import ws_urlpatterns

os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'channelproj.settings')

application = ProtocolTypeRouter({
    "http": get_asgi_application(),
    "websocket": URLRouter(
        ws_urlpatterns
    )
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have imported &lt;strong&gt;ws_urlpatterns&lt;/strong&gt; from &lt;strong&gt;notifier/routing.py&lt;/strong&gt; added &lt;strong&gt;ProtocolTypeRouter&lt;/strong&gt; and defined our websocket urls using &lt;strong&gt;URLRouter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now we will create a template &lt;strong&gt;notifier/templates/home.html&lt;/strong&gt; in our notifier app where we will add a form with an input field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  {% load static %}
  &amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
      &amp;lt;title&amp;gt;Django Channels Status&amp;lt;/title&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;
      &amp;lt;h1&amp;gt;Check Status&amp;lt;/h1&amp;gt;

    &amp;lt;form action="{% url 'staus' %}" method="post"&amp;gt;
      {% csrf_token %}
      &amp;lt;input type="text" placeholder="enter anything" name="TB_sample" id="TB_sample"/&amp;gt;&amp;lt;br&amp;gt;
      &amp;lt;input type="submit" value="submit"&amp;gt;
    &amp;lt;/form&amp;gt;

  &amp;lt;/body&amp;gt;
  &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will add a two function in &lt;strong&gt;notifier/views.py&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.shortcuts import render, redirect
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
import time


def index(request):
    return render(request, 'home.html')

def status_form(request):
    if request.method =='POST':
        num = int(request.POST['TB_sample'])
        progress = 10
        for i in range(num):
            room_group_name = f'notify'
            channel_layer = get_channel_layer()
            async_to_sync(channel_layer.group_send)(
                room_group_name, {
                    "type": "status.notifier",
                    "data": progress
                }
            )
            message = "Status Running"
            progress += 10
            time.sleep(1)

    context = {'message': message}
    return render(request, 'home.html', context)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have defined a function &lt;strong&gt;status_form&lt;/strong&gt; which will be called when a post request happens, it will get the post value in &lt;strong&gt;num&lt;/strong&gt; variable and we have declared a variable called &lt;strong&gt;progress&lt;/strong&gt; with value 10, we have defined a loop which will run and add 10 every time loop runs to &lt;strong&gt;progress&lt;/strong&gt; and sleep for 1 second. We have added &lt;strong&gt;channel_layer = get_channel_layer()&lt;/strong&gt; line to get the channel layer and &lt;strong&gt;async_to_sync&lt;/strong&gt; method to send the data asynchronously to &lt;strong&gt;room_group_name&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Here by declaring &lt;code&gt;"type": "status.notifier"&lt;/code&gt; we are calling  &lt;code&gt;status_notifier&lt;/code&gt; function we wrote in &lt;strong&gt;notifier/consumers.py&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;Also edit &lt;strong&gt;channelproj/urls.py&lt;/strong&gt; file like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from notifier.views import index,status_form

urlpatterns = [
    path('', index),
    path('status/', status_form, name="status"),
    path('admin/', admin.site.urls),
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if we run the project using &lt;code&gt;python manage.py runserver&lt;/code&gt; and open &lt;code&gt;http://127.0.0.1:8000/&lt;/code&gt; url in our browser it will look something like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb9p7jgca5c979cb7i0qp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb9p7jgca5c979cb7i0qp.png" alt="Alt Text" width="592" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check socket status we will use a chrome extension called &lt;strong&gt;Simple WebSocket Client&lt;/strong&gt;. Add the extension and click the extension icon in chrome and insert our web socket url &lt;code&gt;ws://127.0.0.1:8000/ws/status/&lt;/code&gt; and click open, connection should be established.&lt;/p&gt;

&lt;p&gt;Now go to project tab and insert 10 in input filed and submit the form and move to &lt;strong&gt;Simple WebSocket Client&lt;/strong&gt; tab. We will see the status we are sending to socket appearing every second until the loop completes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy4fpihc6pvlcg2ffm6w3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy4fpihc6pvlcg2ffm6w3.png" alt="Socket Status" width="800" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have uploaded a sample project to github you can get &lt;a href="https://github.com/IsrajurRahman/django-channels-sample" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you for reading!
&lt;/h2&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>socket</category>
      <category>djangochannels</category>
    </item>
    <item>
      <title>Convert Microsoft SQL Server Database Tables to CSV</title>
      <dc:creator>Israjur Rahman</dc:creator>
      <pubDate>Fri, 22 Jan 2021 08:46:45 +0000</pubDate>
      <link>https://dev.to/israjurrahman/convert-microsoft-sql-server-database-tables-to-csv-2cd9</link>
      <guid>https://dev.to/israjurrahman/convert-microsoft-sql-server-database-tables-to-csv-2cd9</guid>
      <description>&lt;p&gt;We can convert and save Microsoft SQL Server database tables to CSV using python. I've recently written a python script to automate a process to convert Microsoft SQL Server database tables to CSV format and save it to drive so that I can use it later for other purposes. I've used &lt;a href="https://pypi.org/project/pyodbc/" rel="noopener noreferrer"&gt;pyodbc&lt;/a&gt; and &lt;a href="https://pypi.org/project/pandas/" rel="noopener noreferrer"&gt;pandas&lt;/a&gt; library to automate this process.&lt;/p&gt;

&lt;p&gt;Firstly we have to establish a connection to Microsoft SQL Server database using pyodbc library.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pyodbc 

conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=ISRAJ\SQLEXPRESS;'
                      'Database=TEST_DB;'
                      'Trusted_Connection=yes;')

cursor = conn.cursor()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have provided server name, database name and if it has any username and password we have to add the credentials too.&lt;/p&gt;

&lt;p&gt;After that we will query table names so that we can see the tables we have and can select the table name we want to convert to CSV.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sql = "SELECT TABLE_NAME FROM TEST_DB.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"

cursor.execute(sql)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have written a query to select all the tables from database and by using &lt;strong&gt;cursor.execute&lt;/strong&gt; we are executing the query.&lt;/p&gt;

&lt;p&gt;Now we can loop through the table names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (table_name,) in cursor:
    print(table_name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output will be something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Table_One
Table_Eight
Table_Two
Table_Three
Table_Four
Table_Five
Table_Six
Table_Seven
Table_Nine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will use &lt;strong&gt;pandas&lt;/strong&gt; to get the specific table data to dataframe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas.io.sql as psql

sql = "SELECT * FROM TEST_DB.dbo.Table_One"
df = psql.read_sql(sql, conn)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have written another query to select all from &lt;strong&gt;Table_One&lt;/strong&gt; and &lt;strong&gt;psql.read_sql&lt;/strong&gt; will execute the query and convert the data into dataframe.&lt;/p&gt;

&lt;p&gt;Now we will use pandas &lt;strong&gt;to_csv&lt;/strong&gt; method to save the dataframe as csv.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.to_csv("table_one_in_csv.csv", index=False)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Thanks For Reading!
&lt;/h2&gt;

&lt;p&gt;If you want to test or get the code here I’ve added a simple command line tool to convert Microsoft SQL Server database tables to CSV.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/IsrajurRahman/mssql2csv" rel="noopener noreferrer"&gt;https://github.com/IsrajurRahman/mssql2csv&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>automation</category>
      <category>mssql</category>
    </item>
  </channel>
</rss>
