Replies: 6 comments 9 replies
-
As a next step, I'll work on creating the additional views to make sure using views will actually work for us. Any wrinkles I run into I'll raise here for discussion or troubleshooting. |
Beta Was this translation helpful? Give feedback.
-
A couple of off the cuff suggestions.
|
Beta Was this translation helpful? Give feedback.
-
So, our new view would instead look something like:
|
Beta Was this translation helpful? Give feedback.
-
Just want to bring @qtrinh2 into the conversation. Do you have any preferences or thoughts about how we set up and name these Postgres views? The idea here is we have some sensibly-named views that we can use for exporting datasets as a CSV from Religious Ecologies that we will "release" -- that is, from the RelEc website people will be able to discover and download these datasets without having to mess with our data API. I'm aiming for these to be easily exported from a GUI interface like Postico or DataGrip. Right now this is limited to Religious Ecologies, but I could envision ways were we might have similar setups for future data-driven projects. |
Beta Was this translation helpful? Give feedback.
-
Here are the current views I've defined. Populated places: CREATE VIEW export_relcensus.populated_places
AS SELECT
place_id,
place,
county,
state,
county_ahcb,
population_1920,
population_1930,
elevation,
lat,
lon
FROM
popplaces_1926
ORDER BY state, county; City membership: CREATE VIEW export_relcensus.city_membership
AS SELECT
year,
city,
state,
denomination,
denomination_id,
churches,
members_total,
members_over_13,
members_under_13,
members_male,
members_female,
id
FROM
relcensus.membership_city
ORDER BY year, denomination; Denominations: CREATE VIEW export_relcensus.denominations
AS SELECT
year,
denomination_id,
name,
short_name,
family_census,
family_arda,
family_relec,
id
FROM relcensus.denominations
ORDER BY year, name; |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
To keep the export of data as simple as possible, we'll create PostgreSQL views to set up export tables. We can use these views to either write directly from Postgres or use a GUI like Postico to export to a CSV file.
Here's an idea of how we could do this:
If this seems like a sensible way forward, and a way that works for the various kinds of data and joins we'd like to create, then I'd suggest we also settle on a syntax to keep things organized. Given a view called
export_relcensus_denominations
, the general view syntax might be the following:export_
: This tells us that a view is set up for exporting._relecensus
: This tells us which schema or project an export belongs to._denominations
: This is the name of the table you are exporting. If it's explicitly a single table (i.e., there are noJOIN
statements) it should be the same name of the table you're exporting. If there is aJOIN
, the name of the view should be briefly descriptive of the data you are exporting.In other words, our general syntax for defining a view is
export_<project>_<table>
.Beta Was this translation helpful? Give feedback.
All reactions