We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is bad. If a column has all integers and some blanks it should result in an INTEGER.
Example: this CSV https://github.com/openelections/openelections-data-ca/blob/master/2016/20161108__ca__general__yolo__precinct.csv produces this SQL table:
CREATE TABLE "2016/20161108__ca__general__yolo__precinct" ( "county" TEXT, "precinct" INTEGER, "office" INTEGER, "district" REAL, "party" REAL, "candidate" INTEGER, "votes" INTEGER , FOREIGN KEY (county) REFERENCES county(id), FOREIGN KEY (party) REFERENCES party(id), FOREIGN KEY (precinct) REFERENCES precinct(id), FOREIGN KEY (office) REFERENCES office(id), FOREIGN KEY (candidate) REFERENCES candidate(id))
The text was updated successfully, but these errors were encountered:
https://stackoverflow.com/questions/34383000/pandas-to-sql-all-columns-as-nvarchar/34384664 may be useful here
Sorry, something went wrong.
I ran into the same problem, in my https://github.com/rgieseke/pandas-datapackage-reader reader I convert columns with missing integers to dtype object, but that doesn't help with writing to sql.
object
The Tableschema library (https://github.com/frictionlessdata/tableschema-py) might be helpful here for inferring data types:
test.csv
a,b 1,0.1 2,0.2 ,0.3 4,
from tableschema import infer infer("test.csv")
{ 'fields': [ {'format': 'default', 'name': 'a', 'type': 'integer'}, {'format': 'default', 'name': 'b', 'type': 'number'} ], 'missingValues': [''] }
Fixed in a8ab524 and 0997b7b
@rgieseke your pandas-datapackage-reader tool looks fascinating, I'll definitely have a play with that.
No branches or pull requests
This is bad. If a column has all integers and some blanks it should result in an INTEGER.
Example: this CSV https://github.com/openelections/openelections-data-ca/blob/master/2016/20161108__ca__general__yolo__precinct.csv produces this SQL table:
The text was updated successfully, but these errors were encountered: