You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
984 B
47 lines
984 B
# -*- coding: utf-8 -*-
|
|
import mysql.connector
|
|
|
|
# 连接到 MySQL 数据库
|
|
conn = mysql.connector.connect(
|
|
host="localhost", # 数据库主机地址
|
|
user="root", # 数据库用户名
|
|
password="123123", # 数据库密码
|
|
database='shop'
|
|
)
|
|
|
|
# 创建一个游标对象
|
|
cursor = conn.cursor()
|
|
|
|
# 创建表的 SQL 语句
|
|
create_table_query = """
|
|
CREATE TABLE igs_stations (
|
|
Site_Name VARCHAR(255),
|
|
Country_Region VARCHAR(255) ,
|
|
Receiver VARCHAR(255),
|
|
Antenna VARCHAR(255),
|
|
Radome VARCHAR(255),
|
|
Satellite_System VARCHAR(255),
|
|
Latitude float,
|
|
Longitude float ,
|
|
Height_m float,
|
|
X_m float,
|
|
Y_m float,
|
|
Z_m float,
|
|
Calibration VARCHAR(255),
|
|
Networks VARCHAR(255),
|
|
Data_Center VARCHAR(255),
|
|
IERS_DOMES VARCHAR(255),
|
|
Clock VARCHAR(255),
|
|
Agencies VARCHAR(255),
|
|
Last_Data float
|
|
)
|
|
"""
|
|
|
|
# 执行创建表语句
|
|
cursor.execute(create_table_query)
|
|
|
|
# 提交更改
|
|
conn.commit()
|
|
|
|
# 关闭连接
|
|
conn.close() |