improve performance of python django models.py queryCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
Is there a method for differentiating informative comments from commented out code?
Users forgotting to regenerate PDF before sending it
Why do people prefer metropolitan areas, considering monsters and villains?
Moving millions of files to a different directory with specfic name patterns
Draw a diagram with rectangles
Did depressed people far more accurately estimate how many monsters they killed in a video game?
Other Space Shuttle O-ring failures
How do I separate enchants from items?
Redirecting stderr using exec
I'm feeling like my character doesn't fit the campaign
Tesco's Burger Relish Best Before End date number
What's the adjective used to qualify a software that's available on your first boot?
US citizen traveling with Peruvian passport
Is it possible to complete a PhD in CS in 3 years?
Is it possible for a character at any level to cast all 44 Cantrips in one week without Magic Items?
Clarinets in the Rite of Spring
Write a function
How do ballistic trajectories work in a ring world?
What factors could lead to bishops establishing monastic armies?
How to understand flavors and when to use combination of them?
Where are the Wazirs?
As a supervisor, what feedback would you expect from a PhD who quits?
How to evaluate the performance of open source solver?
Four ships at the ocean with the same distance
improve performance of python django models.py query
Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am loading the website data into Postgres using Python-Django, there are around 9 csv files that i am loading to database but its taking so long ~10 hrs to fetch the data from website, and load it to Postgres. I wanted to increase the performance of the query. Can you guys please help with that?
This is just 1 dataframe, but i have 9 more similar to that, overall data is less than 500k records
from django.db import models
from django_pandas.managers import DataFrameManager
import pandas as pd
from sqlalchemy import create_engine
import zipfile
import os
from urllib.request import urlopen
import urllib.request
import io
from io import BytesIO
class mf(models.Model):
pg_engine = create_engine('postgresql://user:password@server:host/db')
zf = zipfile.ZipFile(BytesIO(urllib.request.urlopen('http://md_file.zip').read()))
df1 = pd.read_csv(zf.open('nm.dat'),header=None,delimiter='|', index_col=0, names=['aaa', 'xxxx', 'yyy','zzz'])
df1.to_sql('nm',pg_engine,if_exists='replace')
python django python-3.x django-models
add a comment |
I am loading the website data into Postgres using Python-Django, there are around 9 csv files that i am loading to database but its taking so long ~10 hrs to fetch the data from website, and load it to Postgres. I wanted to increase the performance of the query. Can you guys please help with that?
This is just 1 dataframe, but i have 9 more similar to that, overall data is less than 500k records
from django.db import models
from django_pandas.managers import DataFrameManager
import pandas as pd
from sqlalchemy import create_engine
import zipfile
import os
from urllib.request import urlopen
import urllib.request
import io
from io import BytesIO
class mf(models.Model):
pg_engine = create_engine('postgresql://user:password@server:host/db')
zf = zipfile.ZipFile(BytesIO(urllib.request.urlopen('http://md_file.zip').read()))
df1 = pd.read_csv(zf.open('nm.dat'),header=None,delimiter='|', index_col=0, names=['aaa', 'xxxx', 'yyy','zzz'])
df1.to_sql('nm',pg_engine,if_exists='replace')
python django python-3.x django-models
why dont you save files you are fetching on local drive?
– Yugandhar Chaudhari
Mar 26 at 6:28
We wanted to automate that process and the company doesnt like anything to save on local
– Bharat Guda
Mar 26 at 16:05
add a comment |
I am loading the website data into Postgres using Python-Django, there are around 9 csv files that i am loading to database but its taking so long ~10 hrs to fetch the data from website, and load it to Postgres. I wanted to increase the performance of the query. Can you guys please help with that?
This is just 1 dataframe, but i have 9 more similar to that, overall data is less than 500k records
from django.db import models
from django_pandas.managers import DataFrameManager
import pandas as pd
from sqlalchemy import create_engine
import zipfile
import os
from urllib.request import urlopen
import urllib.request
import io
from io import BytesIO
class mf(models.Model):
pg_engine = create_engine('postgresql://user:password@server:host/db')
zf = zipfile.ZipFile(BytesIO(urllib.request.urlopen('http://md_file.zip').read()))
df1 = pd.read_csv(zf.open('nm.dat'),header=None,delimiter='|', index_col=0, names=['aaa', 'xxxx', 'yyy','zzz'])
df1.to_sql('nm',pg_engine,if_exists='replace')
python django python-3.x django-models
I am loading the website data into Postgres using Python-Django, there are around 9 csv files that i am loading to database but its taking so long ~10 hrs to fetch the data from website, and load it to Postgres. I wanted to increase the performance of the query. Can you guys please help with that?
This is just 1 dataframe, but i have 9 more similar to that, overall data is less than 500k records
from django.db import models
from django_pandas.managers import DataFrameManager
import pandas as pd
from sqlalchemy import create_engine
import zipfile
import os
from urllib.request import urlopen
import urllib.request
import io
from io import BytesIO
class mf(models.Model):
pg_engine = create_engine('postgresql://user:password@server:host/db')
zf = zipfile.ZipFile(BytesIO(urllib.request.urlopen('http://md_file.zip').read()))
df1 = pd.read_csv(zf.open('nm.dat'),header=None,delimiter='|', index_col=0, names=['aaa', 'xxxx', 'yyy','zzz'])
df1.to_sql('nm',pg_engine,if_exists='replace')
python django python-3.x django-models
python django python-3.x django-models
edited Mar 26 at 0:29
Hybrid
3,9402 gold badges10 silver badges32 bronze badges
3,9402 gold badges10 silver badges32 bronze badges
asked Mar 25 at 22:32
Bharat GudaBharat Guda
497 bronze badges
497 bronze badges
why dont you save files you are fetching on local drive?
– Yugandhar Chaudhari
Mar 26 at 6:28
We wanted to automate that process and the company doesnt like anything to save on local
– Bharat Guda
Mar 26 at 16:05
add a comment |
why dont you save files you are fetching on local drive?
– Yugandhar Chaudhari
Mar 26 at 6:28
We wanted to automate that process and the company doesnt like anything to save on local
– Bharat Guda
Mar 26 at 16:05
why dont you save files you are fetching on local drive?
– Yugandhar Chaudhari
Mar 26 at 6:28
why dont you save files you are fetching on local drive?
– Yugandhar Chaudhari
Mar 26 at 6:28
We wanted to automate that process and the company doesnt like anything to save on local
– Bharat Guda
Mar 26 at 16:05
We wanted to automate that process and the company doesnt like anything to save on local
– Bharat Guda
Mar 26 at 16:05
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347343%2fimprove-performance-of-python-django-models-py-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347343%2fimprove-performance-of-python-django-models-py-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
why dont you save files you are fetching on local drive?
– Yugandhar Chaudhari
Mar 26 at 6:28
We wanted to automate that process and the company doesnt like anything to save on local
– Bharat Guda
Mar 26 at 16:05