# PostgreSQL

リモートのPostgreSQLサーバーに格納されているデータに対してSELECTおよびINSERTクエリを実行することができます。

# 構文

postgresql('host:port', 'database', 'table', 'user', 'password'[, `schema`])

引数

  • host:port — PostgreSQLサーバーのアドレス。
  • database — リモートデータベース名。
  • table — リモートテーブル名。
  • user — PostgreSQLユーザー。
  • password — ユーザーパスワード。
  • schema - デフォルト以外のテーブルスキーマ。オプション。

複数のレプリカをサポートし、|で区切ってリストアップする必要があります。例:

SELECT name FROM postgresql(`postgres_host{1|2|3}:5432`, '[postgres_database]', '[postgres_table]', '[postgres_user]', '[postgres_password]', '[postgres_schema]');

または

SELECT name FROM postgresql(`postgres_host1:3306|postgres_host2:3306|postgres_host3:5432`, '[postgres_database]', '[postgres_table]', '[postgres_user]', '[postgres_password]', '[postgres_schema]');

PostgreSQL辞書ソースのレプリカの優先度をサポートしています。マップ内の数値が大きいほど、優先度が低くなります。最も優先度の高いものは0です。

# 返される値

元のPostgreSQLテーブルと同じ列を持つテーブルオブジェクト。

#

# PostgreSQLのテーブル

# CREATE TABLE
postgres=> CREATE TABLE laion_dataset (
    id serial,
    url character varying(2048) null,
    caption character varying(2048) null,
    similarity float null,
    image_embedding vector(512) not null,
    text_embedding vector(512) not null,
    constraint laion_dataset_not_null_pkey primary key (id)
);
CREATE TABLE
# INSERT 
postgres=> INSERT INTO laion_dataset (id, url, caption, similarity, image_embedding, text_embedding) VALUES (1, 'https://chairish-prod.global.ssl.fastly.net/image/product/sized/188616b7-8743-452f-80f7-f94fee39830e/vintage-1970s-pottery-face-masks-a-pair-5154?aspect=fit&width=320&height=320', 'Vintage 1970 s Pottery Face Masks - A Pair', 0.3163678050041199, '[-0.02861, -0.004993, 0.0176, -0.0248, 0.03488, -0.015305, 0.01443, 0.04288, 0.010445, 0.04367, -0.001831, -0.03995, -0.05573, 0.01904, -0.01917, -0.01417, 0.02216, 0.02058, 0.01971, 0.00787, -0.02325, 0.04266, -0.03818, -0.00986, -0.05045, 0.03848, 0.001489, 0.04782, -0.00926, -0.04608, 0.03143, -0.05823, 0.008095, 0.00861, -0.0786, 0.00556, 0.01193, -0.00713, 0.0177, -0.0632, -0.03583, 0.02283, 0.00988, 0.02643, -0.015434, -0.03186, -0.01237, 0.02002, 0.0462, -0.04834, 0.005222, 0.02295, 0.0285, -0.02783, -0.0466, 0.011475, -0.03017, -0.01006, -0.009895, -0.013176, 0.00468, -0.0537, 0.0731, -0.02336, -0.01278, -0.01662, 0.02805, 0.001102, -0.02553, 0.00408, -0.02647, 0.02095, 0.02165, -0.03635, 0.010445, 0.02252, -0.08154, -0.006218, 0.002993, 0.003038, 0.001144, -0.0384, -0.02321, -0.0792, -0.002878, 0.022, 0.084, 0.005867, -0.06744, -0.01596, -0.00377, -0.01888, -0.635, 0.07874, 0.0424, 0.003754, -0.04828, -0.01857, -0.005497, 0.0499, 0.05206, -0.02397, 0.04355, 0.0348, -0.0191, 0.01463, -0.1586, -0.05652, -0.02994, 0.03043, 0.02791, -0.01836, -0.02188, -0.002123, -0.01904, -0.0669, 0.003218, -0.02531, -0.0292, -0.0292, 0.04025, 0.00588, 0.04208, 0.01376, 0.0261, 0.02986, 0.011696, 0.013954, -0.00822, 0.00972, 0.01733, -0.02048, -0.02669, 0.09174, 0.07904, 0.03665, 0.01399, -0.00611, -0.03882, -0.01433, -0.0461, 0.04712, -0.0482, -0.0403, -0.03888, 0.01027, 0.00677, -0.005577, -0.02892, 0.01328, -0.02522, -0.0386, 0.0808, -0.02612, -0.0035, -0.04395, -0.0212, -0.0068, -0.002234, -0.01081, -0.05173, -0.02814, -0.02695, -0.04825, -0.03592, -0.01816, 0.03943, -0.002943, -0.01345, -0.0173, -0.015015, -0.002201, 0.01276, -0.007126, -0.01596, 0.03345, -0.005955, -0.00646, -0.01473, 0.02704, 0.0711, 0.000505, 0.03125, -0.0273, 0.00594, -0.02768, 0.00932, -0.03824, -0.0461, 0.03128, -0.0364, -0.00785, 0.01363, -0.003027, 0.03029, -0.02046, -0.01177, 0.0257, -0.04263, 0.006836, 0.05618, -0.0472, 0.03217, 0.01878, 0.00133, -0.002802, -0.01895, 0.00751, 0.02377, 0.03275, -0.0636, 0.07385, 0.03574, -0.0293, -0.01775, -0.000553, 0.03265, -0.001203, -0.03458, -0.0161, -0.02814, -0.00799, -0.012024, 0.02258, -0.06244, -0.02943, -0.02885, 0.0172, 0.0296, 0.002745, -0.003841, 0.016, -0.0412, 0.0667, 0.02028, 0.0316, 0.004337, 0.014885, -0.001251, -0.000914, 0.0107, -0.007706, 0.04147, -0.0187, -0.0936, 0.01619, -0.02135, 0.0285, -0.02655, 0.01854, 0.001666, -0.002312, 0.03122, -0.002966, 0.01407, 0.014755, -0.02356, 0.01182, -0.1526, -0.00497, 0.05392, -0.01402, 0.001146, -0.02243, -0.02937, -0.01158, -0.03848, 0.002888, 0.01863, -0.04266, -0.01637, 0.0218, -0.0178, 0.03912, 0.01337, -0.02037, -0.04034, 0.02043, -0.014626, 0.02359, 0.001643, 0.00774, -0.0004714, -0.005234, 0.003456, 0.00191, -0.0496, -0.0598, -0.01653, 0.00913, 0.02812, -0.03403, -0.01304, -0.03262, 0.008316, -0.002798, -0.02408, 0.03485, 0.03485, 0.02164, -0.04993, 0.01014, -0.02899, -0.01947, -0.02403, -0.05814, 0.02438, 0.01028, -0.006947, 0.00988, -0.0566, 0.00862, 0.0916, 0.00898, 0.033, 0.01624, 0.02522, 0.02983, -0.001787, -0.04932, 0.001491, 0.1976, -0.010155, -0.0424, 0.002007, -0.04208, 0.006554, 0.002789, -0.03735, -0.003721, 0.03885, -0.0489, 0.02812, -0.06223, -0.01797, 0.00646, 0.04425, 0.02252, -0.03763, 0.002525, 0.03442, 0.003466, -0.007465, 0.01231, -0.04303, 0.04858, 0.01744, 0.001178, -0.04477, -0.0682, 0.03915, 0.01588, 0.0443, -0.036, 0.02057, 0.01272, -0.04947, 0.001778, 0.01472, -0.003809, 0.04633, -0.04544, -0.01157, -0.05978, -0.06433, -0.03384, -0.001926, -0.04694, -0.01519, 0.0038, 0.02696, -0.003414, 0.014084, 0.0002823, -0.0379, -0.04184, 0.07434, 0.03375, -0.02263, 0.01906, -0.01863, -0.06323, 0.03134, 0.03232, 0.003, 0.007042, 0.0006247, 0.01886, -0.079, 0.0332, -0.04803, -0.013954, -0.0269, -0.04187, 0.02051, 0.0248, -0.001965, -0.03061, -0.002272, -0.01347, -0.02258, 0.00449, 0.0865, -0.02834, 0.0211, -0.0339, -0.02588, 0.02864, 0.0253, -0.01872, 0.007835, 0.01287, 0.006966, 0.0119, -0.04385, -0.01584, -0.000661, 0.04358, -0.0829, 0.01293, 0.004208, -0.02608, -0.00766, 0.0386, 0.0003712, -0.01765, -0.001041, -0.0239, 0.03888, 0.03111, 0.01732, 0.02141, 0.04898, -0.04422, -0.084, 0.03387, 0.02895, -0.03046, 0.02414, 0.02135, 0.03134, 0.0422, -0.016, 0.04092, -0.005135, -0.04648, 0.04117, -0.000757, -0.02518, 0.01878, 0.02768, 0.02682, -0.02588, -0.05753, 0.04312, 0.004593, -0.01788, 0.03262, 0.02367, -0.0354, 0.003466, 0.0419, -0.0166, -0.00856, 0.03415, 0.004856, -0.04807, 0.003626, 0.0001568, 0.03333, -0.003765, 0.013824, -0.002298, -0.01945, 0.01161, 0.005756, -0.000729, -0.009575, 0.001631, 0.003183, 0.01486, -0.03232, 0.011765, -0.01243, 0.003016, 0.03003, 0.03687, 0.06854, -0.04706, -0.04187, 0.01298, -0.0349, 0.00975, -0.05093, -0.01807, 0.00795, -0.002728, -0.012215, 0.04282, -0.00955, 0.007267, -0.013954, 0.04678, -0.01324, -0.01678, -0.02887, 0.01982, -0.01622, -0.005173, 0.05432, -0.02643, -0.03017]', '[0.002466, -0.0615, -0.03017, -0.01123, 0.01449, -0.02669, 0.0602, -0.004955, -0.0777, -0.015274, 0.03552, -0.013725, -0.0636, 0.005867, 0.02367, 0.01272, 0.05316, 0.06964, 0.0467, 0.02219, -0.01195, 0.01836, -0.04947, -0.03568, 0.02953, -0.05347, -0.00697, 0.0323, 0.01721, 0.006657, -0.002981, -0.05865, 0.01234, -0.0334, -0.1311, 0.03857, 0.01744, -0.00315, 0.05902, 0.0219, 0.007423, 0.00909, -0.0292, 0.0695, -0.001302, -0.007534, 0.02986, 0.01405, 0.05807, -0.003605, -0.01706, 0.0397, -0.02608, -0.02034, 0.1096, -0.04535, 0.01525, -0.066, 0.03485, 0.006077, -0.02531, 0.02075, 0.0576, -0.0889, 0.00256, 0.02467, 0.007263, 0.02419, -0.041, -0.02106, 0.0945, -0.002798, 0.0326, -0.02472, -0.03552, 0.0671, -0.0657, 0.0442, 0.001114, -0.02148, 0.005695, -0.05823, 0.02684, -0.02765, -0.03055, -0.002502, 0.002241, 0.07355, -0.0425, -0.009445, -0.0374, 0.0215, -0.0761, 0.0744, -0.01441, -0.02104, -0.0206, -0.0445, -0.004234, 0.04184, -0.015335, 0.006256, 0.01473, 0.02892, 0.00934, -0.0409, 0.01793, -0.1245, -0.02745, 0.0008607, 0.012535, -0.06046, -0.002035, 0.05927, -0.03857, -0.04648, 0.03232, 0.01301, 0.0137, -0.08856, -0.01584, -0.1335, -0.002361, 0.014275, 0.02596, -0.01387, 0.03044, -0.0356, 0.0222, 0.01648, -0.02548, 0.01947, -0.04037, 0.3643, 0.007362, 0.05637, -0.006435, -0.01139, -0.04727, 0.01008, -0.03168, 0.001604, 0.05508, -0.00915, -0.05008, 0.0037, -0.01733, -0.03787, 0.02365, -0.003326, -0.001089, -0.01678, -0.01361, 0.04425, -0.02507, -0.03394, 0.04718, 0.01396, 0.0162, -0.04987, 0.02676, 0.005043, 0.002865, -0.04126, -0.04474, -0.0188, -0.006344, -0.0417, -0.0114, -0.0546, -0.03687, -0.02707, 0.0218, -0.01854, 0.0235, 0.0381, 0.03555, -0.03928, 0.010185, 0.01485, -0.03108, -0.09576, 0.03754, -0.0711, -0.06195, 0.01666, 0.02808, 0.006916, 0.0331, 0.0079, 0.00808, 0.02473, 0.007793, 0.02783, 0.02826, -0.02675, 0.001899, 0.01979, -0.03555, -0.02464, -0.03815, 0.01544, -0.004944, -0.0247, -0.006966, -0.0001417, 0.05392, 0.02766, 6.884e-05, -0.0352, -0.04074, 0.03946, 0.03748, 0.00819, 0.05185, -0.00978, 0.03506, -0.01833, 0.003704, 0.01398, 0.00944, 0.00323, -0.04022, 0.0834, -0.0648, -0.003174, 0.002996, 0.001719, -0.03021, -0.0383, 0.01656, 0.0422, 0.03105, 0.01805, -0.006847, 0.03265, -0.00395, -0.03702, 0.0187, 0.05035, 0.00702, -0.08594, -0.03986, 0.04636, -0.08844, -0.06073, 0.02411, 0.0533, 0.0171, 0.012566, -0.0002985, 0.003159, 0.00912, -0.001899, -0.03265, -0.0454, -0.06195, -0.01246, -0.01773, -0.08636, 0.03714, -0.0586, -0.01834, -0.01106, -0.01872, 0.02437, -0.04025, -0.01281, 0.03354, -0.099, -0.014206, 0.01492, 0.006535, 0.001753, 0.003132, -0.00172, 0.02937, -0.04202, 0.02727, -0.01955, -0.02597, 0.00995, -0.0254, -0.01235, 0.05612, -0.0753, -0.038, 0.06616, -0.01823, -0.02194, 0.02025, -0.0259, 0.0232, -0.03992, 0.09314, -0.04416, 0.03854, 0.0716, -0.003078, 0.01732, -0.02617, 0.00918, 0.00667, 0.002647, 0.006256, -0.003765, 0.02318, 0.03864, -0.0746, -0.02042, 0.00989, -0.01313, 0.3643, -0.0459, 0.01717, -0.01327, 0.03577, 0.03366, -0.04077, -0.01415, 0.0141, 0.04498, -0.038, -0.0324, 0.003485, 0.04126, -0.01125, 0.0079, -0.01019, 0.03099, -0.01206, -0.00398, -0.03464, -0.05383, 0.014725, 0.0353, 0.05035, 0.01273, -0.0552, -0.02576, -0.004955, 0.05093, -0.02675, -0.001552, -0.058, -0.0293, 0.0434, 0.0831, -0.0706, -0.02887, 0.04492, -0.03387, 0.02544, 0.06366, 0.02585, 0.04602, 0.01191, 0.04572, -0.02252, -0.03008, -0.00944, 0.05124, -0.03647, -0.0415, -0.0396, -0.03513, -0.003456, 0.01552, -0.0742, 0.05133, -0.00364, 0.0678, -0.0554, 0.01984, -0.10657, -0.04184, 0.03775, 0.03775, -0.003077, -0.018, -0.03064, -0.06903, -0.01128, 0.0833, -0.03894, 0.0607, -0.0361, -0.02483, -0.0025, -0.0219, -0.0627, -0.04016, 0.006287, -0.06107, 0.0572, 0.01529, 0.002375, -0.013756, 0.04315, -0.004364, -0.06354, -0.011116, 0.0446, 0.03607, 0.00812, -0.002687, 0.02676, 0.01573, -0.02554, -0.03754, 0.00303, 0.0381, 0.02246, -0.03888, -0.04633, -0.010345, 0.010086, 0.01585, -0.001357, 0.007797, -0.0497, -0.04822, 0.0132, -0.04538, 0.03467, -0.0379, 0.0015545, 0.02238, -0.002935, 0.0229, 0.000892, -0.0441, 0.04733, 0.001521, -0.02914, 0.0003738, 0.0736, -0.03598, 0.009056, 0.01501, 0.01287, -0.00436, -0.02141, 0.05203, -0.01796, -0.01036, 0.0113, 0.02274, -0.02815, 0.000557, 0.045, -0.0405, -0.06287, -0.06903, 0.0717, 0.0566, -0.04626, -0.000635, 0.01952, -0.01183, 0.002922, -0.02057, -0.038, 0.02258, 0.03766, 0.04526, -0.04233, -0.0226, -0.04993, -0.02849, -0.0213, -0.015434, -0.01738, 0.00905, -0.007233, 0.04785, -0.010376, 0.02498, 0.0354, 0.00671, 0.01213, 0.0134, -0.073, -0.003582, 0.006733, 0.008514, 0.05923, 0.05847, 0.03592, -0.00784, -0.02306, -0.02597, -0.0143, 0.02951, -0.02402, -0.00812, 0.0505, -0.00526, -0.0107, -0.00259, 0.06305, -0.03915, 0.0167, -0.0367, 0.09296, -0.06757, 0.03607, -0.0724, 0.02461, 0.02708, 0.003849, -0.0576]');
INSERT 0 1
# SELECT
postgres=> SELECT id, caption FROM laion_dataset;
(1 row)
 id |                  caption                   
----+--------------------------------------------
  1 | Vintage 1970 s Pottery Face Masks - A Pair

# Postgresからデータを選択する

SELECT * FROM postgresql('[host:port]', '[database]', 'laion_dataset', '[postgres_user]', '[postgres_password]') WHERE id = 1;
| id | url | caption | similarity | image_embedding | text_embedding |
|----|-----|---------|------------|-----------------|----------------|
| 1 | https://chairish-prod.global.ssl.fastly.net/image/product/sized/188616b7-8743-452f-80f7-f94fee39830e/vintage-1970s-pottery-face-masks-a-pair-5154?aspect=fit&width=320&height=320 | Vintage 1970s Pottery Face Masks - A Pair | 0.31636780500412 | [-0.02861,-0.004993,0.0176,-0.0248,0.03488,... | [0.002466,-0.0615,-0.03017,-0.01123,0.01449,... |

# PostgresテーブルからデータをMyScaleテーブルにコピーする

# MyScaleテーブルを作成
CREATE TABLE default.laion_dataset
(
    `id` Int64,
    `url` String,
    `caption` String,
    `similarity` Nullable(Float32),
    `image_embedding` Array(Float32),
     CONSTRAINT check_length CHECK length(image_embedding) = 512,
    `text_embedding` Array(Float32),
     CONSTRAINT check_length CHECK length(text_embedding) = 512
)
ENGINE = MergeTree
ORDER BY id;
# INSERT 
INSERT INTO default.laion_dataset 
SELECT id, url, caption, similarity, image_embedding, text_embedding
FROM postgresql('[host:port]','[database]', 'laion_dataset', '[postgres_user]', '[postgres_password]');
# SELECT
SELECT * FROM default.laion_dataset;
| id | url | caption | similarity | image_embedding   | text_embedding    |
|----|-----|---------|------------|-------------------|-------------------|
| 1  | https://chairish-prod.global.ssl.fastly.net/image/product/sized/188616b7-8743-452f-80f7-f94fee39830e/vintage-1970s-pottery-face-masks-a-pair-5154?aspect=fit&width=320&height=320 | Vintage 1970s Pottery Face Masks - A Pair | 0.3163678 | [-0.02861, -0.004, 0.017, -0.024, 0.034, ... | [0.002466, -0.0615, -0.03017, -0.011, 0.014, ... |

# 挿入

# INSERT
INSERT INTO TABLE FUNCTION postgresql('[host:port]','[database]', 'laion_dataset', '[postgres_user]', '[postgres_password]') 
    (id, url, caption, similarity, image_embedding, text_embedding) 
VALUES 
    (2000001, 'https://chairish-prod.global.ssl.fastly.net/image/product/sized/188616b7-8743-452f-80f7-f94fee39830e/vintage-1970s-pottery-face-masks-a-pair-5154?aspect=fit&width=320&height=320', 'Vintage 1970 s Pottery Face Masks - A Pair', 0.3163678050041199, '[-0.02861, -0.004993, 0.0176, -0.0248, 0.03488, -0.015305, 0.01443, 0.04288, 0.010445, 0.04367, -0.001831, -0.03995, -0.05573, 0.01904, -0.01917, -0.01417, 0.02216, 0.02058, 0.01971, 0.00787, -0.02325, 0.04266, -0.03818, -0.00986, -0.05045, 0.03848, 0.001489, 0.04782, -0.00926, -0.04608, 0.03143, -0.05823, 0.008095, 0.00861, -0.0786, 0.00556, 0.01193, -0.00713, 0.0177, -0.0632, -0.03583, 0.02283, 0.00988, 0.02643, -0.015434, -0.03186, -0.01237, 0.02002, 0.0462, -0.04834, 0.005222, 0.02295, 0.0285, -0.02783, -0.0466, 0.011475, -0.03017, -0.01006, -0.009895, -0.013176, 0.00468, -0.0537, 0.0731, -0.02336, -0.01278, -0.01662, 0.02805, 0.001102, -0.02553, 0.00408, -0.02647, 0.02095, 0.02165, -0.03635, 0.010445, 0.02252, -0.08154, -0.006218, 0.002993, 0.003038, 0.001144, -0.0384, -0.02321, -0.0792, -0.002878, 0.022, 0.084, 0.005867, -0.06744, -0.01596, -0.00377, -0.01888, -0.635, 0.07874, 0.0424, 0.003754, -0.04828, -0.01857, -0.005497, 0.0499, 0.05206, -0.02397, 0.04355, 0.0348, -0.0191, 0.01463, -0.1586, -0.05652, -0.02994, 0.03043, 0.02791, -0.01836, -0.02188, -0.002123, -0.01904, -0.0669, 0.003218, -0.02531, -0.0292, -0.0292, 0.04025, 0.00588, 0.04208, 0.01376, 0.0261, 0.02986, 0.011696, 0.013954, -0.00822, 0.00972, 0.01733, -0.02048, -0.02669, 0.09174, 0.07904, 0.03665, 0.01399, -0.00611, -0.03882, -0.01433, -0.0461, 0.04712, -0.0482, -0.0403, -0.03888, 0.01027, 0.00677, -0.005577, -0.02892, 0.01328, -0.02522, -0.0386, 0.0808, -0.02612, -0.0035, -0.04395, -0.0212, -0.0068, -0.002234, -0.01081, -0.05173, -0.02814, -0.02695, -0.04825, -0.03592, -0.01816, 0.03943, -0.002943, -0.01345, -0.0173, -0.015015, -0.002201, 0.01276, -0.007126, -0.01596, 0.03345, -0.005955, -0.00646, -0.01473, 0.02704, 0.0711, 0.000505, 0.03125, -0.0273, 0.00594, -0.02768, 0.00932, -0.03824, -0.0461, 0.03128, -0.0364, -0.00785, 0.01363, -0.003027, 0.03029, -0.02046, -0.01177, 0.0257, -0.04263, 0.006836, 0.05618, -0.0472, 0.03217, 0.01878, 0.00133, -0.002802, -0.01895, 0.00751, 0.02377, 0.03275, -0.0636, 0.07385, 0.03574, -0.0293, -0.01775, -0.000553, 0.03265, -0.001203, -0.03458, -0.0161, -0.02814, -0.00799, -0.012024, 0.02258, -0.06244, -0.02943, -0.02885, 0.0172, 0.0296, 0.002745, -0.003841, 0.016, -0.0412, 0.0667, 0.02028, 0.0316, 0.004337, 0.014885, -0.001251, -0.000914, 0.0107, -0.007706, 0.04147, -0.0187, -0.0936, 0.01619, -0.02135, 0.0285, -0.02655, 0.01854, 0.001666, -0.002312, 0.03122, -0.002966, 0.01407, 0.014755, -0.02356, 0.01182, -0.1526, -0.00497, 0.05392, -0.01402, 0.001146, -0.02243, -0.02937, -0.01158, -0.03848, 0.002888, 0.01863, -0.04266, -0.01637, 0.0218, -0.0178, 0.03912, 0.01337, -0.02037, -0.04034, 0.02043, -0.014626, 0.02359, 0.001643, 0.00774, -0.0004714, -0.005234, 0.003456, 0.00191, -0.0496, -0.0598, -0.01653, 0.00913, 0.02812, -0.03403, -0.01304, -0.03262, 0.008316, -0.002798, -0.02408, 0.03485, 0.03485, 0.02164, -0.04993, 0.01014, -0.02899, -0.01947, -0.02403, -0.05814, 0.02438, 0.01028, -0.006947, 0.00988, -0.0566, 0.00862, 0.0916, 0.00898, 0.033, 0.01624, 0.02522, 0.02983, -0.001787, -0.04932, 0.001491, 0.1976, -0.010155, -0.0424, 0.002007, -0.04208, 0.006554, 0.002789, -0.03735, -0.003721, 0.03885, -0.0489, 0.02812, -0.06223, -0.01797, 0.00646, 0.04425, 0.02252, -0.03763, 0.002525, 0.03442, 0.003466, -0.007465, 0.01231, -0.04303, 0.04858, 0.01744, 0.001178, -0.04477, -0.0682, 0.03915, 0.01588, 0.0443, -0.036, 0.02057, 0.01272, -0.04947, 0.001778, 0.01472, -0.003809, 0.04633, -0.04544, -0.01157, -0.05978, -0.06433, -0.03384, -0.001926, -0.04694, -0.01519, 0.0038, 0.02696, -0.003414, 0.014084, 0.0002823, -0.0379, -0.04184, 0.07434, 0.03375, -0.02263, 0.01906, -0.01863, -0.06323, 0.03134, 0.03232, 0.003, 0.007042, 0.0006247, 0.01886, -0.079, 0.0332, -0.04803, -0.013954, -0.0269, -0.04187, 0.02051, 0.0248, -0.001965, -0.03061, -0.002272, -0.01347, -0.02258, 0.00449, 0.0865, -0.02834, 0.0211, -0.0339, -0.02588, 0.02864, 0.0253, -0.01872, 0.007835, 0.01287, 0.006966, 0.0119, -0.04385, -0.01584, -0.000661, 0.04358, -0.0829, 0.01293, 0.004208, -0.02608, -0.00766, 0.0386, 0.0003712, -0.01765, -0.001041, -0.0239, 0.03888, 0.03111, 0.01732, 0.02141, 0.04898, -0.04422, -0.084, 0.03387, 0.02895, -0.03046, 0.02414, 0.02135, 0.03134, 0.0422, -0.016, 0.04092, -0.005135, -0.04648, 0.04117, -0.000757, -0.02518, 0.01878, 0.02768, 0.02682, -0.02588, -0.05753, 0.04312, 0.004593, -0.01788, 0.03262, 0.02367, -0.0354, 0.003466, 0.0419, -0.0166, -0.00856, 0.03415, 0.004856, -0.04807, 0.003626, 0.0001568, 0.03333, -0.003765, 0.013824, -0.002298, -0.01945, 0.01161, 0.005756, -0.000729, -0.009575, 0.001631, 0.003183, 0.01486, -0.03232, 0.011765, -0.01243, 0.003016, 0.03003, 0.03687, 0.06854, -0.04706, -0.04187, 0.01298, -0.0349, 0.00975, -0.05093, -0.01807, 0.00795, -0.002728, -0.012215, 0.04282, -0.00955, 0.007267, -0.013954, 0.04678, -0.01324, -0.01678, -0.02887, 0.01982, -0.01622, -0.005173, 0.05432, -0.02643, -0.03017]', '[0.002466, -0.0615, -0.03017, -0.01123, 0.01449, -0.02669, 0.0602, -0.004955, -0.0777, -0.015274, 0.03552, -0.013725, -0.0636, 0.005867, 0.02367, 0.01272, 0.05316, 0.06964, 0.0467, 0.02219, -0.01195, 0.01836, -0.04947, -0.03568, 0.02953, -0.05347, -0.00697, 0.0323, 0.01721, 0.006657, -0.002981, -0.05865, 0.01234, -0.0334, -0.1311, 0.03857, 0.01744, -0.00315, 0.05902, 0.0219, 0.007423, 0.00909, -0.0292, 0.0695, -0.001302, -0.007534, 0.02986, 0.01405, 0.05807, -0.003605, -0.01706, 0.0397, -0.02608, -0.02034, 0.1096, -0.04535, 0.01525, -0.066, 0.03485, 0.006077, -0.02531, 0.02075, 0.0576, -0.0889, 0.00256, 0.02467, 0.007263, 0.02419, -0.041, -0.02106, 0.0945, -0.002798, 0.0326, -0.02472, -0.03552, 0.0671, -0.0657, 0.0442, 0.001114, -0.02148, 0.005695, -0.05823, 0.02684, -0.02765, -0.03055, -0.002502, 0.002241, 0.07355, -0.0425, -0.009445, -0.0374, 0.0215, -0.0761, 0.0744, -0.01441, -0.02104, -0.0206, -0.0445, -0.004234, 0.04184, -0.015335, 0.006256, 0.01473, 0.02892, 0.00934, -0.0409, 0.01793, -0.1245, -0.02745, 0.0008607, 0.012535, -0.06046, -0.002035, 0.05927, -0.03857, -0.04648, 0.03232, 0.01301, 0.0137, -0.08856, -0.01584, -0.1335, -0.002361, 0.014275, 0.02596, -0.01387, 0.03044, -0.0356, 0.0222, 0.01648, -0.02548, 0.01947, -0.04037, 0.3643, 0.007362, 0.05637, -0.006435, -0.01139, -0.04727, 0.01008, -0.03168, 0.001604, 0.05508, -0.00915, -0.05008, 0.0037, -0.01733, -0.03787, 0.02365, -0.003326, -0.001089, -0.01678, -0.01361, 0.04425, -0.02507, -0.03394, 0.04718, 0.01396, 0.0162, -0.04987, 0.02676, 0.005043, 0.002865, -0.04126, -0.04474, -0.0188, -0.006344, -0.0417, -0.0114, -0.0546, -0.03687, -0.02707, 0.0218, -0.01854, 0.0235, 0.0381, 0.03555, -0.03928, 0.010185, 0.01485, -0.03108, -0.09576, 0.03754, -0.0711, -0.06195, 0.01666, 0.02808, 0.006916, 0.0331, 0.0079, 0.00808, 0.02473, 0.007793, 0.02783, 0.02826, -0.02675, 0.001899, 0.01979, -0.03555, -0.02464, -0.03815, 0.01544, -0.004944, -0.0247, -0.006966, -0.0001417, 0.05392, 0.02766, 6.884e-05, -0.0352, -0.04074, 0.03946, 0.03748, 0.00819, 0.05185, -0.00978, 0.03506, -0.01833, 0.003704, 0.01398, 0.00944, 0.00323, -0.04022, 0.0834, -0.0648, -0.003174, 0.002996, 0.001719, -0.03021, -0.0383, 0.01656, 0.0422, 0.03105, 0.01805, -0.006847, 0.03265, -0.00395, -0.03702, 0.0187, 0.05035, 0.00702, -0.08594, -0.03986, 0.04636, -0.08844, -0.06073, 0.02411, 0.0533, 0.0171, 0.012566, -0.0002985, 0.003159, 0.00912, -0.001899, -0.03265, -0.0454, -0.06195, -0.01246, -0.01773, -0.08636, 0.03714, -0.0586, -0.01834, -0.01106, -0.01872, 0.02437, -0.04025, -0.01281, 0.03354, -0.099, -0.014206, 0.01492, 0.006535, 0.001753, 0.003132, -0.00172, 0.02937, -0.04202, 0.02727, -0.01955, -0.02597, 0.00995, -0.0254, -0.01235, 0.05612, -0.0753, -0.038, 0.06616, -0.01823, -0.02194, 0.02025, -0.0259, 0.0232, -0.03992, 0.09314, -0.04416, 0.03854, 0.0716, -0.003078, 0.01732, -0.02617, 0.00918, 0.00667, 0.002647, 0.006256, -0.003765, 0.02318, 0.03864, -0.0746, -0.02042, 0.00989, -0.01313, 0.3643, -0.0459, 0.01717, -0.01327, 0.03577, 0.03366, -0.04077, -0.01415, 0.0141, 0.04498, -0.038, -0.0324, 0.003485, 0.04126, -0.01125, 0.0079, -0.01019, 0.03099, -0.01206, -0.00398, -0.03464, -0.05383, 0.014725, 0.0353, 0.05035, 0.01273, -0.0552, -0.02576, -0.004955, 0.05093, -0.02675, -0.001552, -0.058, -0.0293, 0.0434, 0.0831, -0.0706, -0.02887, 0.04492, -0.03387, 0.02544, 0.06366, 0.02585, 0.04602, 0.01191, 0.04572, -0.02252, -0.03008, -0.00944, 0.05124, -0.03647, -0.0415, -0.0396, -0.03513, -0.003456, 0.01552, -0.0742, 0.05133, -0.00364, 0.0678, -0.0554, 0.01984, -0.10657, -0.04184, 0.03775, 0.03775, -0.003077, -0.018, -0.03064, -0.06903, -0.01128, 0.0833, -0.03894, 0.0607, -0.0361, -0.02483, -0.0025, -0.0219, -0.0627, -0.04016, 0.006287, -0.06107, 0.0572, 0.01529, 0.002375, -0.013756, 0.04315, -0.004364, -0.06354, -0.011116, 0.0446, 0.03607, 0.00812, -0.002687, 0.02676, 0.01573, -0.02554, -0.03754, 0.00303, 0.0381, 0.02246, -0.03888, -0.04633, -0.010345, 0.010086, 0.01585, -0.001357, 0.007797, -0.0497, -0.04822, 0.0132, -0.04538, 0.03467, -0.0379, 0.0015545, 0.02238, -0.002935, 0.0229, 0.000892, -0.0441, 0.04733, 0.001521, -0.02914, 0.0003738, 0.0736, -0.03598, 0.009056, 0.01501, 0.01287, -0.00436, -0.02141, 0.05203, -0.01796, -0.01036, 0.0113, 0.02274, -0.02815, 0.000557, 0.045, -0.0405, -0.06287, -0.06903, 0.0717, 0.0566, -0.04626, -0.000635, 0.01952, -0.01183, 0.002922, -0.02057, -0.038, 0.02258, 0.03766, 0.04526, -0.04233, -0.0226, -0.04993, -0.02849, -0.0213, -0.015434, -0.01738, 0.00905, -0.007233, 0.04785, -0.010376, 0.02498, 0.0354, 0.00671, 0.01213, 0.0134, -0.073, -0.003582, 0.006733, 0.008514, 0.05923, 0.05847, 0.03592, -0.00784, -0.02306, -0.02597, -0.0143, 0.02951, -0.02402, -0.00812, 0.0505, -0.00526, -0.0107, -0.00259, 0.06305, -0.03915, 0.0167, -0.0367, 0.09296, -0.06757, 0.03607, -0.0724, 0.02461, 0.02708, 0.003849, -0.0576]');
# SELECT
SELECT * FROM postgresql('[host:port]','[database]', 'laion_dataset', '[postgres_user]', '[postgres_password]')  where id = 2000001;
| id | url | caption | similarity | image_embedding | text_embedding |
|----|-----|---------|------------|-----------------|----------------|
| 2,000,001 | https://chairish-prod.global.ssl.fastly.net/image/product/sized/188616b7-8743-452f-80f7-f94fee39830e/vintage-1970s-pottery-face-masks-a-pair-5154?aspect=fit&width=320&height=320 | Vintage 1970s Pottery Face Masks - A Pair | 0.31636780500412 | [-0.02861, -0.004993, 0.0176, -0.0248, 0.03488, -0.015305, 0.01443, 0.04288, 0.010445, ... | [0.002466, -0.0615, -0.03017, -0.01123, 0.01449, -0.02669, 0.0602, -0.004955, -0.0777, -0.015274, ... |

# デフォルト以外のスキーマの使用

postgres=> CREATE SCHEMA "nice.schema";
 CREATE SCHEMA
postgres=> CREATE TABLE "nice.schema"."nice.table" (a integer);
 CREATE TABLE
postgres=> INSERT INTO "nice.schema"."nice.table" SELECT i FROM generate_series(0, 99) as t(i);
CREATE TABLE pg_table_schema_with_dots (a UInt32)
 ENGINE PostgreSQL('[host:port]', '[database]', 'nice.table', '[postgres_user]', '[postgres_password]', 'nice.schema');

# 関連コンテンツ