Python Forum
Securing State Constitutions (USA) from University of Maryland > MariaDB .sql
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Securing State Constitutions (USA) from University of Maryland > MariaDB .sql
#2
Admins/Moderators: I attempted to edit my OP and I received a message too long error as included in below screenshots! I was forced to post a reply. Please understand!

**** Update: 01/21/2022 @ Approx. 10:35 ****

Without knowing the best way to approach this; I decided to use LibreCalc and create a 5 column CSV and use copy and paste from .TXT (in BlueFish using the line numbers to keep track).

Then using the CSV to MariaDB/MySQL Payload Python Script Below (This one I have specified column "fulltext_contents" to be datatype[dtype] "LONGTEXT"; I was receiving errors after row 1 on LibreCalc CSV when testing:

import pandas as pd
import mysql.connector
from sqlalchemy import create_engine
from sqlalchemy.dialects.mysql import LONGTEXT
dtype = { "fulltext_contents": LONGTEXT }


myd = pd.read_csv('UMD_WA_1889_CSV2.csv')

engine = create_engine('mysql+mysqlconnector://brandon:[email protected]/Exodus_J3x_Dev_Bronson')

myd.to_sql(name='UMD_WA_1889_CSV2', con=engine, if_exists='replace', index=False, dtype=dtype)
What you will notice is a comparison between CSV -> SQL (And the Text *Formatting* being wrong). Row 1 worked perfect. Then the rest was failing. And then once I viewed it using HeidiSQL it alters somehow and scrolls (i.e without wordwrap persay). ?

Then I was frustrated and decided to start manually copy and pasting directly into SQL using HeidiSQL again.

While it's *keeping* proper formatting if I open the HeidiSQL cell dialog box and paste and then click check/okay/save. All seems fine.

Then I compared row #1 (the one that worked before needing to specify LONGTEXT on fulltext_contents column) from CSV -> SQL using Python and SQL Alchemy vs. Manual Data Entry (Copy and Paste) from .TXT using BlueFish and the following screenshots is what happened.

I'm confused at how to proceed properly. It seems row 1 entries from LibreCalc, saved as a CSV and then imported using Python and SQL Alchemy created a "perfect entry". Perfect, meaning it kept formatting exactly like in Text, UTF-8 (.TXT).

However, that perfect formatting didn't continue as I continued with entries below row 1 on LibreCalc (CSV) file.

You can see how it doesn't keep the formatting on the entire text file in row 2 and requires me to "scroll endlessly to the right with zero maintained text formatting". -- So... virtually pointless.

My manual Data Entry directly into SQL using HeidiSQL seems fruitful; however, there are spacing issues between lines that are *not* there on LibreCalc CSV row 1 (as seen in screenshots). Comparing the both leaves me scratching my head.

Moving forward with manual entry into SQL vs. LibreCalc CSV is providing me with gapped formatting in spacing.

And continuing with what I was doing with Entries pasted into LibreCalc CSV stopped working as seen on row 2.

Does anyone know what's happening here and what's the best practices to achieve LibreCalc CSV -> SQL (row 1) 's perfect formatting for *ALL* entries? And is there a way to do this without pasting into LibreCalc (perhaps a different way of loading my paste's into a CSV a different method perhaps that wouldn't fail by unknown reasons to me).

Thank you all for this forum!

Here are the screen shots:

[Image: Libre-Calc-1-2022-01-21-10-04-01.png]
free picture upload

Perfect Formatting:
[Image: UMD-WA-1889-4-CSV-SQL-1-2022-01-21-10-05-22.png]
share picture

[Image: UMD-WA-1889-4-CSV-SQL-2-2022-01-21-10-06-27.png]

Not Perfect Formatting (Almost -- Double Spaces?):
[Image: UMD-WA-1889-DE-SQL-1-2022-01-21-10-07-08.png]

[Image: Blue-Fish-Wash-1889-Copy-and-Paste-1-202...-08-16.png]

Failed Editing Message (Too Long):

[Image: FAIL-EDIT-2022-01-21-10-26-59.png]
picture to url
“And one of the elders saith unto me, Weep not: behold, the Lion of the tribe of Juda, the Root of David, hath prevailed to open the book,...” - Revelation 5:5 (KJV)

“And oppress not the widow, nor the fatherless, the stranger, nor the poor; and ...” - Zechariah 7:10 (KJV)

#LetHISPeopleGo

Reply


Messages In This Thread
RE: Securing State Constitutions (USA) from University of Maryland > MariaDB .sql - by BrandonKastning - Jan-21-2022, 06:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Python Obstacles | Jeet-Kune-Do | BS4 (Tags > MariaDB) [URL/Local HTML] BrandonKastning 0 1,428 Feb-08-2022, 08:55 PM
Last Post: BrandonKastning
Question Securing King James Bible (KJV) + King James Bible 1611 (KJV1611) in MariaDB/MySQL BrandonKastning 4 2,721 Jan-18-2022, 03:42 PM
Last Post: BrandonKastning
Exclamation Debian 10 Buster Environment - Python 3.x (MariaDB 10.4.21) | Working Connector? BrandonKastning 9 4,307 Jan-04-2022, 08:27 PM
Last Post: BrandonKastning
  Python Obstacles | Karate | HTML/Scrape Specific Tag and Store it in MariaDB BrandonKastning 8 3,182 Nov-22-2021, 01:38 AM
Last Post: BrandonKastning
  Build a simple Webapp with Python Flask and mariaDB newbie1 3 3,406 Jun-04-2020, 09:34 PM
Last Post: lmolter54
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to write 3 Columns to MariaDB? BrandonKastning 21 7,008 Mar-23-2020, 05:51 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020