如果我尝试删除不存在的约束:在修订文件中
op.drop_constraint('exists_in_some_db_fkey', 'table', type='foreignkey')
Run Code Online (Sandbox Code Playgroud)
我有:
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedObject)
constraint "exists_in_some_db_fkey" of relation "table" does not exist
[SQL: 'ALTER TABLE extensions DROP CONSTRAINT exists_in_some_db_fkey']
(Background on this error at: http://sqlalche.me/e/f405)
Run Code Online (Sandbox Code Playgroud)
这是我们的错,我们有一些损坏的数据库,但如果我们可以删除约束检查 IF EXISTS,它可以解决我们的问题。
我们最近无法更改我们的模型。
我想用两个单词分割一个字符串:
s <- "PCB153 treated HepG2 cells at T18"
strsplit(s, split = <treated><at>)
Run Code Online (Sandbox Code Playgroud)
我应该写什么而不是<>?
我会得到:
"PCB153" "HepG2 cells" "T18"
Run Code Online (Sandbox Code Playgroud) 我有这个清单:
a <- list(list(c("sam1", "control"), c("sam1", "latanoprost free acid", "GSM6683", "GSM6684"), c("sam1", "prostaglandin F2alpha", "GSM6687", "GSM6688")), list(c("sam2", "control"), c("sam2", "latanoprost free acid", "GSM6681", "GSM6682"), c("sam2", "prostaglandin F2alpha", "GSM6685", "GSM6686")))
Run Code Online (Sandbox Code Playgroud)
我想删除长度小于三(<3)的元素(列表).我尝试了双重lapply来获得[[i]] [[j]]和< - NULL,但是我只获得了带有NULL的列表.像这样:
b <- lapply(seq(length(a)),function(i){
lapply(seq(length(a[[1]])),function(j){
if(length(a[[i]][[j]]) < 3) {a[[i]][[j]] <- NULL}
})
})
Run Code Online (Sandbox Code Playgroud)
感谢您的任何帮助...
我有一个清单:
a <- ["12file.txt", "8file.txt", "66file.txt"]
Run Code Online (Sandbox Code Playgroud)
我想按数字排序:
a would be: ["8file.txt", "12file.txt", "66file.txt"]
Run Code Online (Sandbox Code Playgroud)
现在我只能得到这个:
a = ["12file.txt", "66file.txt", "8file.txt"]
Run Code Online (Sandbox Code Playgroud)
谢谢