0

I am attempting to load geojson from a file into mssql express using sqlalchemy for the insert and geopandas to load and read the file. sqlserver examples seems to be hard to find, but below is what i was able to scrape together at this point, which doesn't work.

geodataframe = geopandas.read_file(fname)
geodataframe['geom'] = geodataframe['geometry'].apply(lambda x: WKTElement(x.wkt, srid=4326))
geodataframe.drop('geometry', 1, inplace=True)
geodataframe.to_sql('geo', engine, if_exists='append', index=False,dtype={'geom': Geometry('POINT', srid= 4326)})

does anyone have a working example of loading geojson into Sql Server sqlexpress with python?

4

0 回答 0