Comments (7)
Closing, fixed downstream. Thanks @dpprdan!
from rpostgres.
Fixed in {sf}: r-spatial/sf#2223
from rpostgres.
This only concerns the sf::dbWriteTable()
method, so I think this is better handled there than here.
However, this is partly caused by RPostgres::dbWriteTable()
stop()
ing if append && !is.null(field.types)
RPostgres/R/dbWriteTable_PqConnection_character_data.frame.R
Lines 24 to 26 in 58a052b
This also happens when the table does not (yet) exist, i.e. when there is nothing to append
to.
Do you think it would be possible to move this check a few lines down and only stop
if the table is found
, @krlmlr?
Right now, dbWriteTable will create the table anyway if no field.types
are provided.
RPostgres/R/dbWriteTable_PqConnection_character_data.frame.R
Lines 60 to 63 in 58a052b
The downside is that dbWriteTable(append = TRUE, field.types = "something")
will work when the table does not exist but stop when it does. This might be confusing. However, we could ameliorate this by issuing a message "You wanted to append, but the table does not exist yet so we created it".
Of course, third-party methods have to provide custom field.types for their datatypes, like sfc, so field.types
cannot be NULL for them. So they cannot create a table currently if append = TRUE
but the table does not exist.
from rpostgres.
Thanks, missed that. IIUC, we can fix this by fixing sf::dbWriteTable()
?
from rpostgres.
Thanks, missed that. IIUC, we can fix this by fixing
sf::dbWriteTable()
?
Yes. But the fix is a bit ugly (IMO, i.e. overriding function arguments).
IMHO it would be best, i.e. cleanest, if append
were only possible if the table already exists, but that's probably too much of a breaking change.
from rpostgres.
There are new generics dbCreateTable()
and dbAppendTable()
, does sf support these?
from rpostgres.
Ha, I just had a similar thought, i.e. refactor sf::dbWriteTable()
using dbCreateTable()
and dbAppendTable()
.
So no, sf does not support/use them yet.
Anyway, I am not convinced by my "create table if append = TRUE" proposal above myself anymore, so this can be closed IMO.
from rpostgres.
Related Issues (20)
- collation warning on Ubuntu 22.04 HOT 4
- Unable to create table with logical column HOT 4
- relicense RPostgres as MIT HOT 2
- using databases.pacha.dev for testing HOT 4
- Curious bug with transaction and `dbSendQuery()` HOT 6
- Schema with DBI::Id appears not to work with `dbListTables` HOT 4
- Redshift: dbWriteTable() with larger DFs and CSVs HOT 3
- Bigints in dbQuoteLiteral HOT 4
- Something wrong with the 1.4.5 Mac binary on CRAN with Redshift HOT 33
- How to deal with `pq__varchar` columns HOT 11
- vendoring cpp11 headers HOT 1
- RPostgres should respect system timezone rather than default to UTC HOT 9
- unnamed `Id()` breaks `dbQuoteIdentifier()` HOT 10
- Option to convert "enum" types to factor or character? HOT 11
- Memory leak when querying from a packaged function HOT 3
- RPostgres dbConnect crashes with segfault in R 4.2.3 running on RHEL 8 HOT 1
- Configuration failed because libpq was not found. HOT 7
- dbGetQuery failing due to stale Redshift OIDs HOT 6
- `dbAppendTable()` is incompatible with PostgreSQL row-level security enabled (COPY FROM not supported) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpostgres.