Converting CSV to SQL with Python

  Рет қаралды 28,585

A&G Statworks

A&G Statworks

Күн бұрын

Пікірлер: 43
@pleabargain
@pleabargain 3 жыл бұрын
Thank you! I followed along exactly as you demonstrated and I got my CSV into sqlite programmatically! Thank you!
@tonygojanovic554
@tonygojanovic554 3 жыл бұрын
You're welcome!
@dominickbudzisz9651
@dominickbudzisz9651 4 жыл бұрын
Thank you so much! This was exactly what I have needed for the last five hours! You are a god send!
@tonygojanovic554
@tonygojanovic554 3 жыл бұрын
Glad I could help!
@anthonywilly8756
@anthonywilly8756 3 жыл бұрын
Please , how do you manage to print the row into a text file. how did you manage to save your print(row) to a text file. thank you.
@danielevans5125
@danielevans5125 4 жыл бұрын
Thanks for the clear explanation and clean/clear code! It's much appreciated. There very well could be some user-error on my part, but I found that executing and committing one row at a time was very slow for me (again, maybe this was my fault!). In a similar approach, I dumped the csv file contents into a list (using a list comprehension) and then used "cur.executemany()" to populate the database all at once...this worked for me and my data (about 30 MB) in probably one second or less. Just wanted to share in case others experience a similar issue. Another alternative is to read the csv file into a Pandas dataframe and then output the dataframe to a sqlite database.
@tonygojanovic554
@tonygojanovic554 4 жыл бұрын
Thanks, I appreciate the feedback and suggestions.
@agstatworks3701
@agstatworks3701 4 жыл бұрын
Thanks for the comment!
@vasudevdevadiga1563
@vasudevdevadiga1563 4 жыл бұрын
Hey can you please share your code with me ? It will be of great help. My mailid is namitachetan9287@gmail.com
@danielevans257
@danielevans257 4 жыл бұрын
Hi
@ravirajkhatu5624
@ravirajkhatu5624 3 жыл бұрын
I am getting error when there is a blank in the file and it is giving data type error when it is INT type column. Is there any solution?
@mustafadar254
@mustafadar254 3 жыл бұрын
How can we initialise a column if it has date time values Like this: datetime=DATETIME(row[0]) ??
@Sreenu1523
@Sreenu1523 3 жыл бұрын
Hi I need to compare data text file with db table below scenarios Note: text file don't have header 1. Count of records file and table 2. Is file data same as in table It would be great if u share any video or link
@vasudevdevadiga1563
@vasudevdevadiga1563 4 жыл бұрын
What if the CSV file has headers
@paulpavlinskyi4793
@paulpavlinskyi4793 3 жыл бұрын
You can remove a header. Next it while reading or use pop(), remove() functions.
@creyssu
@creyssu 3 жыл бұрын
i'm trying to do an webapp to query some data an this is exactly what i need, thank you so much!!
@tonygojanovic554
@tonygojanovic554 3 жыл бұрын
Glad I can help!!
@mainfurina
@mainfurina 3 жыл бұрын
My acutally Problem on this code is: attribute4 = row[4] IndexError: list index out of range. The last row is really speciality, thats why some data sets have 4 entries and some 5, but I don't know how i could say: if the last row don't exist in some datasets that you can add an entry for attribute4 = "N/A". I'm to new in python xD.
@shivampatel4179
@shivampatel4179 Жыл бұрын
can I get the source code??
@labheshlalka9666
@labheshlalka9666 4 жыл бұрын
Thank you ..it was a wonderful explaination...for csv file
@agstatworks3701
@agstatworks3701 4 жыл бұрын
Thank you!
@agstatworks3701
@agstatworks3701 4 жыл бұрын
Thank you for the comment!
@me.6803
@me.6803 2 жыл бұрын
@@agstatworks3701 this code running on which ide
@nazarm6215
@nazarm6215 3 жыл бұрын
I'm enticed to switch over for scripting race conditions in nodejs are killing me.
@martygeorgiev6086
@martygeorgiev6086 4 жыл бұрын
Whatever I do I keep getting an error like ' TypeError: function takes at most 2 arguments (10 given) '. Can anyone give me hint on how to solve that, please?
@Styleitwithvaish
@Styleitwithvaish 3 жыл бұрын
Facing same issue. Did you get any solution?
@martygeorgiev6086
@martygeorgiev6086 3 жыл бұрын
@@Styleitwithvaish Yes, I got the solution and i will be able to help you out. I am quite busy at the moment but I will post the solution as a comment here so look again after 3 or 4 hours ;)
@martygeorgiev6086
@martygeorgiev6086 3 жыл бұрын
Can you show me ur code somehow please?
@martygeorgiev6086
@martygeorgiev6086 3 жыл бұрын
@@Styleitwithvaish I'm sorry for the late replay. ' StonedCannibal#5445 ' is my Discord account, add if you want, will be easier to share my code as well
@hjsjsetyjdytj
@hjsjsetyjdytj 4 жыл бұрын
Thanks for the tutorial! Your exact code didn't work for me ... I had to change all the '?' to '%s' for my code to work, but that was about it!
@agstatworks3701
@agstatworks3701 4 жыл бұрын
Super! Glad I could help!
@mustafadar254
@mustafadar254 3 жыл бұрын
why %s Antonio?
@goodnight2565
@goodnight2565 2 жыл бұрын
no way i am a big fan of EXO, the korean boy band and i am learning python... seeing exoplanet here is just an amazing coincidence
@agstatworks3701
@agstatworks3701 2 жыл бұрын
Cool!
@jananishanmugam8204
@jananishanmugam8204 4 жыл бұрын
Thank you so much... This helped me a lot
@agstatworks3701
@agstatworks3701 4 жыл бұрын
You are very welcome!
@mustafadar254
@mustafadar254 3 жыл бұрын
@@agstatworks3701 How can we initialise a column if it has date time values Like this: datetime=DATETIME(row[0]) ??
@entersac
@entersac 4 жыл бұрын
pleace conpart you projest
@adamnagy4544
@adamnagy4544 2 жыл бұрын
SQLite studio is do it for you without any code dude....
@tonygojanovic554
@tonygojanovic554 2 жыл бұрын
Thanks for your insight! Greatly appreciated!
@OggVorbis69
@OggVorbis69 3 жыл бұрын
This is a great example how not to do this task. This is sadly what I see when working with so called web programmers that are touting a great effort in their attempt to not use the most useful and in some cases expensive piece of their system -their database. Please viewers, use this as an sql example in python. Never import DSV in a db especially in volume by sql statement per row. This is slow, loads your db cpu and is just to efficient. I’m so sad when I see web systems just crippled by this type of using the db.
@tonygojanovic554
@tonygojanovic554 3 жыл бұрын
Thanks for the reply and insight. There are many ways to do things in this world, some work better than others for some things, and some don't (This applies to not only programming...you should try woodworking some day). Depends on the context and application of your problem. For some problems, a simple solutions like this works well. Others it may not. You can always build and modify on solutions or try something unique and better. I am open to suggestions and ideas. Thanks for the comment and have a great programming day!
@yisunshin7245
@yisunshin7245 3 жыл бұрын
@TS, if you know so much, make a video and show us all how it’s done. Your criticism without context, credibility, credentials, nor demonstrating an example of how it’s done is beyond childish.
Building a fancy bar graph in R
11:06
A&G Statworks
Рет қаралды 395
Upload A CSV File (Or Any Data File) To SQLite Using Python
5:44
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 20 МЛН
How to whistle ?? 😱😱
00:31
Tibo InShape
Рет қаралды 13 МЛН
黑的奸计得逞 #古风
00:24
Black and white double fury
Рет қаралды 11 МЛН
How to store data with Python and SQLite3
9:15
John Watson Rooney
Рет қаралды 44 М.
Import CSV file to SQL Server Using Python | SQL | Python
12:24
Stats Wire
Рет қаралды 42 М.
SQL | Python | How to Connect SQL Database to Python using Pyodbc
6:35
Learn at Knowstar
Рет қаралды 22 М.
Automating File Loading Into SQL Server With Python And SQL - Part 1
9:47
How to Read Very Big Files With SQL and Pandas in Python
7:20
Data Science Garage
Рет қаралды 42 М.