Skip to content

Commit 2b8c07c

Browse files
NicolappsConvex, Inc.
authored and
Convex, Inc.
committed
Parse Fivetran CSV files (#26137)
GitOrigin-RevId: 797fc70b09ec53c31adc7a030e7079165795ca02
1 parent 2308de6 commit 2b8c07c

27 files changed

+1589
-9
lines changed

Cargo.lock

Lines changed: 112 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ resolver = "2"
44
exclude = [ "crates/fivetran_source", "crates/py_client", "crates/python_client_tests" ]
55

66
[workspace.dependencies]
7+
aes = { version = "0.8.4" }
78
anyhow = "1"
89
async-broadcast = "0.7.0"
910
async-channel = "1.9.0"
11+
async-compression = { version = "0.4.8", features = [ "tokio", "zstd", "gzip" ] }
1012
async-recursion = "1.1.1"
1113
async-trait = "0.1"
1214
async_zip = { version = "0.0.9", default-features = false, features = [ "zstd", "deflate" ] }
15+
cbc = { version = "0.1.2" }
1316
csv-async = "1.2"
1417
atomic_refcell = "0.1.10"
1518
axum = { version = "0.6", features = [ "headers", "ws", "original-uri", "macros", "multipart" ] }
@@ -98,6 +101,7 @@ ring = "0.17.0"
98101
rsa = "0.9.0"
99102
rusqlite = { version = "0.30", features = [ "bundled" ] }
100103
saffron = { git = "https://github.com/get-convex/saffron", rev = "1d842379919fb5c1988ac127cebd6167b1eb9bec", features = [ "std" ] }
104+
schemars = { version = "0.8" }
101105
semver = { version = "1", features = [ "serde" ] }
102106
sentry = { version = "0.31", features = [ "anyhow", "tower", "tower-http" ] }
103107
serde = { version = "1", features = [ "derive" ] }
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[package]
2+
name = "convex_fivetran_destination"
3+
description = "Fivetran destination for Convex (convex.dev)"
4+
version = "0.0.1"
5+
authors = ["Convex, Inc. <[email protected]>"]
6+
edition = "2021"
7+
resolver = "2"
8+
license = "Apache-2.0"
9+
repository = "https://github.com/get-convex/convex-fivetran-source"
10+
homepage = "https://www.convex.dev/"
11+
12+
[lib]
13+
name = "convex_fivetran_destination"
14+
path = "src/lib.rs"
15+
16+
[dependencies]
17+
aes = { workspace = true }
18+
anyhow = { workspace = true }
19+
async-compression = { workspace = true }
20+
async-trait = { workspace = true }
21+
base64 = { workspace = true }
22+
cbc = { workspace = true }
23+
chrono = { workspace = true }
24+
common = { path = "../common" }
25+
csv-async = { workspace = true }
26+
derive_more = { workspace = true }
27+
futures = { workspace = true }
28+
futures-async-stream = { workspace = true }
29+
maplit = { workspace = true }
30+
prost = { workspace = true }
31+
prost-types = { workspace = true }
32+
reqwest = { workspace = true, features = ["json", "native-tls-vendored"] }
33+
serde = { workspace = true, features = ["derive"] }
34+
serde_json = { workspace = true }
35+
thiserror = { workspace = true }
36+
tokio = { workspace = true }
37+
tokio-stream = { workspace = true }
38+
tonic = { workspace = true, features = ["gzip"] }
39+
url = { workspace = true }
40+
41+
[build-dependencies]
42+
cfg-if = { workspace = true }
43+
tonic-build = { workspace = true }
44+
45+
[dev-dependencies]
46+
common = { path = "../common", features = ["testing"] }
47+
proptest = { workspace = true }
48+
proptest-derive = { workspace = true }
49+
rand = { workspace = true }
50+
uuid = { workspace = true }
51+
52+
[package.metadata.cargo-machete]
53+
ignored = [
54+
# Build dependencies not understood
55+
"cfg_if",
56+
"tonic_build",
57+
# Prost required via tonic macro
58+
"prost",
59+
]

crates/fivetran_destination/build.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
use std::{
2+
io::Result,
3+
path::Path,
4+
};
5+
6+
cfg_if::cfg_if! {
7+
if #[cfg(target_os = "macos")] {
8+
const PROTOC_BINARY_NAME: &str = "protoc-macos-universal";
9+
} else if #[cfg(all(target_os = "linux", target_arch = "aarch64"))] {
10+
const PROTOC_BINARY_NAME: &str = "protoc-linux-aarch64";
11+
} else if #[cfg(all(target_os = "linux", target_arch = "x86_64"))] {
12+
const PROTOC_BINARY_NAME: &str = "protoc-linux-x86_64";
13+
} else {
14+
panic!("no protoc binary available for this architecture");
15+
}
16+
}
17+
18+
fn set_protoc_path() {
19+
let root = Path::new("../pb_build/protoc");
20+
if root.exists() {
21+
let include_path = std::fs::canonicalize(root.join("include"))
22+
.expect("Failed to canonicalize protoc include path");
23+
std::env::set_var("PROTOC_INCLUDE", include_path);
24+
let binary_path = std::fs::canonicalize(root.join(PROTOC_BINARY_NAME))
25+
.expect("Failed to canonicalize protoc path");
26+
std::env::set_var("PROTOC", binary_path);
27+
}
28+
}
29+
30+
fn main() -> Result<()> {
31+
set_protoc_path();
32+
33+
tonic_build::configure().btree_map(["."]).compile(
34+
&["protos/common.proto", "protos/destination_sdk.proto"],
35+
&["protos/"],
36+
)?;
37+
38+
Ok(())
39+
}

0 commit comments

Comments
 (0)