Как извлечь имя таблицы, имя столбца, информацию о типе данных и описание из метаданных SQL с помощью Python? [закрыто]Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Как извлечь имя таблицы, имя столбца, информацию о типе данных и описание из метаданных SQL с помощью Python? [закрыто]

Сообщение Anonymous »

У меня есть информация о схеме SQL ниже:
CREATE TABLE businesstable (
business_id VARCHAR(50) PRIMARY KEY, -- Unique ID for each business
name VARCHAR(255), -- Name of the business
address VARCHAR(255), -- address of the business
city VARCHAR(100), -- city where the business is located
state VARCHAR(10), -- state with two letter US code where the business is located
postal_code VARCHAR(20), -- US zip code where the business is located
latitude DECIMAL(10,7), -- latitude coordinates of the business location
longitude DECIMAL(10,7), -- longitude coordinates of the business location
stars DECIMAL(2,1), -- number of star rating for the business
review_count INTEGER, -- total number of reviews for the business
is_open INTEGER, -- is the business open
attributes JSONB, -- Json formatted attributes of the business
categories VARCHAR(1000), -- categories that business belongs to
hours JSONB -- business open hours in a week grouped by day
);
-- businesstable.business_id can be joined with reviewtable.business_id

CREATE TABLE usertable (
user_id CHAR(22) PRIMARY KEY,-- Unique ID for each user.
name VARCHAR(60), -- Name of the user.
average_stars DECIMAL(2, 1), -- average stars given by user ,default value is 0.
review_count INTEGER , -- the number of reviews written by user.
fans INTEGER, -- number of fans the user has.
funny INTEGER, -- number of funny votes sent by the user.
cool INTEGER, -- number of cool votes sent by the user.
);

CREATE TABLE checkintable (
day VARCHAR (9) PRIMARY KEY, -- day of review which was given by user
time VARCHAR (5) PRIMARY KEY, -- time of review which was given by the user
business_id CHAR (22) PRIMARY KEY, -- -- Review given by the user against the business ID
customers INTEGER,-- Unique ID for each customer

);
-- usertable.user_id can be joined with reviewtable.user_id

Из приведенных выше метаданных мне нужно извлечь следующую информацию о ссылках с помощью Python.
Примечание: ссылки всегда между таблицей, но некоторые таблицы нет информации о ссылках
Пример ожидаемого результата:
{businesstable:[businesstable.business_id can be joined with reviewtable.business_id.],usertable:[usertable.user_id can be joined with reviewtable.user_id.]


Подробнее здесь: https://stackoverflow.com/questions/783 ... on-from-sq
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»