feat: add sql as a valid type in Python

This commit is contained in:
Ruben Fiszel
2023-01-23 15:58:23 +01:00
parent 0c8180db35
commit 004593539f
2 changed files with 15 additions and 2 deletions
@@ -104,6 +104,7 @@ pub fn parse_python_signature(code: &str) -> error::Result<MainArgSignature> {
"bytes" => Typ::Bytes,
"datetime" => Typ::Datetime,
"datetime.datetime" => Typ::Datetime,
"Sql" | "sql" => Typ::Sql,
_ => Typ::Resource(id),
},
_ => Typ::Unknown,
@@ -60,9 +60,15 @@
localStorage.removeItem(script.path)
script.schema = script.schema ?? emptySchema()
if (!script.schema) {
try {
await inferArgs(script.language, script.content, script.schema)
} catch (error) {
sendUserToast(
`Impossible to infer the schema. Assuming this is a script without main function`,
true
)
}
const newHash = await ScriptService.createScript({
workspace: $workspaceStore!,
requestBody: {
@@ -87,7 +93,13 @@
async function changeStep(step: number) {
if (step > 1) {
script.schema = script.schema ?? emptySchema()
await inferArgs(script.language, script.content, script.schema)
try {
await inferArgs(script.language, script.content, script.schema)
} catch (error) {
console.info(
'Impossible to infer the schema. Assuming this is a script without main function'
)
}
}
goto(`?step=${step}`)
}