mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
scaffold - insertQuery
Example for upsert query for mysql & postgres variants
This commit is contained in:
parent
4a02389eb0
commit
96c62bd34d
|
@ -102,6 +102,10 @@ enabled = false
|
||||||
dir = "./filerrdb" # directory to store rocksdb files
|
dir = "./filerrdb" # directory to store rocksdb files
|
||||||
|
|
||||||
[mysql] # or memsql, tidb
|
[mysql] # or memsql, tidb
|
||||||
|
# Empty insertQuery will use the default insert query
|
||||||
|
# example insertQuery can be for UPSERT syntax:
|
||||||
|
# insertQuery = """INSERT INTO ` + "`%s`" + ` (dirhash,name,directory,meta) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE meta = VALUES(meta)"""
|
||||||
|
insertQuery = ""
|
||||||
# CREATE TABLE IF NOT EXISTS filemeta (
|
# CREATE TABLE IF NOT EXISTS filemeta (
|
||||||
# dirhash BIGINT COMMENT 'first 64 bits of MD5 hash value of directory field',
|
# dirhash BIGINT COMMENT 'first 64 bits of MD5 hash value of directory field',
|
||||||
# name VARCHAR(1000) BINARY COMMENT 'directory or file name',
|
# name VARCHAR(1000) BINARY COMMENT 'directory or file name',
|
||||||
|
@ -123,6 +127,10 @@ interpolateParams = false
|
||||||
|
|
||||||
[mysql2] # or memsql, tidb
|
[mysql2] # or memsql, tidb
|
||||||
enabled = false
|
enabled = false
|
||||||
|
# Empty insertQuery will use the default insert query
|
||||||
|
# example insertQuery can be for UPSERT syntax:
|
||||||
|
# insertQuery = """INSERT INTO ` + "`%s`" + ` (dirhash,name,directory,meta) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE meta = VALUES(meta)"""
|
||||||
|
insertQuery = ""
|
||||||
createTable = """
|
createTable = """
|
||||||
CREATE TABLE IF NOT EXISTS ` + "`%s`" + ` (
|
CREATE TABLE IF NOT EXISTS ` + "`%s`" + ` (
|
||||||
dirhash BIGINT,
|
dirhash BIGINT,
|
||||||
|
@ -143,6 +151,10 @@ connection_max_lifetime_seconds = 0
|
||||||
interpolateParams = false
|
interpolateParams = false
|
||||||
|
|
||||||
[postgres] # or cockroachdb, YugabyteDB
|
[postgres] # or cockroachdb, YugabyteDB
|
||||||
|
# Empty insertQuery will use the default insert query
|
||||||
|
# example insertQuery can be for UPSERT syntax:
|
||||||
|
# insertQuery = """INSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4) ON CONFLICT ON CONSTRAINT "%[1]s_pkey" DO UPDATE SET meta = EXCLUDED.meta WHERE "%[1]s".meta != EXCLUDED.meta"""
|
||||||
|
insertQuery = ""
|
||||||
# CREATE TABLE IF NOT EXISTS filemeta (
|
# CREATE TABLE IF NOT EXISTS filemeta (
|
||||||
# dirhash BIGINT,
|
# dirhash BIGINT,
|
||||||
# name VARCHAR(65535),
|
# name VARCHAR(65535),
|
||||||
|
@ -164,6 +176,10 @@ connection_max_lifetime_seconds = 0
|
||||||
|
|
||||||
[postgres2]
|
[postgres2]
|
||||||
enabled = false
|
enabled = false
|
||||||
|
# Empty insertQuery will use the default insert query
|
||||||
|
# example insertQuery can be for UPSERT syntax:
|
||||||
|
# insertQuery = """INSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4) ON CONFLICT ON CONSTRAINT "%[1]s_pkey" DO UPDATE SET meta = EXCLUDED.meta WHERE "%[1]s".meta != EXCLUDED.meta"""
|
||||||
|
insertQuery = ""
|
||||||
createTable = """
|
createTable = """
|
||||||
CREATE TABLE IF NOT EXISTS "%s" (
|
CREATE TABLE IF NOT EXISTS "%s" (
|
||||||
dirhash BIGINT,
|
dirhash BIGINT,
|
||||||
|
|
Loading…
Reference in a new issue