Comments (5)
Hi @rogozin, thanks for reporting this.
Just curious, is there a specific reason you're calling model_name
here? The in_partition
method currently returns an ActiveRecord::Relation
. The anonymous class wasn't really meant to be leaked and interacted with (outside of chaining query methods).
But I think you're right, delegating name
to the parent class seems like a reasonable thing to do.
from pg_party.
Hi @rkrage, thanks for your answer 👍
Frankly I'm using activerecord-import with ON CONFILCT expression, so in fact I'm calling
TMainDatum.import huge_data_array, on_duplicate_key_update: { target_and_column_options }
And of course it won't work because there are PG partition restrictions for on_conflict usage .
Eventually I'm targeting specific partition like this:
TMainDatum.in_partition('t_main_data_2017_34').import huge_data_array, on_duplicate_key_update: { target_and_column_options }
and it works well, but the only exception as I've described above :)
from pg_party.
Ah, okay. Honestly, I didn't think a whole lot about use cases for in_partition
. Maybe it makes sense to change the API a little bit then - have it return the raw child class so users can interact with it directly?
I have a pull request up that fixes the bug (#14), but I'll try to revise it a bit to reflect this API change.
Sound good?
from pg_party.
Side note, if it sounds like in_partition
will be a widely used method, we might want to consider adding a bit of validation (check that the partition is actually a child partition of the parent), and add some class caching (to reduce the amount of child classes that are dynamically created).
Sounds like that work should be in a separate PR though.
from pg_party.
@rogozin the fix should be included in version 0.6.0
from pg_party.
Related Issues (20)
- Multiple Key Partition HOT 3
- Update readme for 1.2.0 release
- Question: schema_exclude_partitions = false development workflow HOT 7
- Feature request: select range partitions by one of date HOT 3
- Fix ruby 2.7 keyword argument warnings HOT 2
- Use #create_list_partition_of in rake task? HOT 1
- Partition by ForeignKey? HOT 11
- rspec tests fail unless using structure.sql HOT 2
- Explanation needed: Are many "partition tables" a problem? HOT 2
- Convert a normal table to partitioned table HOT 2
- ActiveRecord doesn't support composite primary keys? HOT 4
- Rails 6.1 support HOT 2
- Address Rails 6.1 deprecation warnings HOT 2
- Any talks to move some of these features into Rails core? HOT 7
- No changelog entry for 1.5.0 HOT 3
- The way I setup on Rails 6.1 HOT 1
- Migration from `partitioned` gem to `pg_party` HOT 1
- pg_dump: error: cross-database references are not implemented HOT 1
- create_range_partition and Ruby 3 HOT 7
- Migrating from 0.7.3 to 1.6.0 process HOT 2
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 pg_party.