workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
<https://i.stack.imgur.com/4BZmZ.jpg>
2018-01-18T14:34:32.000359
Floy
pythondev_help_Floy_2018-01-18T14:34:32.000359
1,516,286,072.000359
29,624
pythondev
help
I mean that with as much respect as possible ha
2018-01-18T14:34:38.000618
Bella
pythondev_help_Bella_2018-01-18T14:34:38.000618
1,516,286,078.000618
29,625
pythondev
help
so, if you look at that graph
2018-01-18T14:34:51.000200
Floy
pythondev_help_Floy_2018-01-18T14:34:51.000200
1,516,286,091.0002
29,626
pythondev
help
why not implement either a serivce interface, or data access components
2018-01-18T14:35:07.000422
Floy
pythondev_help_Floy_2018-01-18T14:35:07.000422
1,516,286,107.000422
29,627
pythondev
help
so your code would call that code, which would handle the db interaction
2018-01-18T14:35:22.000614
Floy
pythondev_help_Floy_2018-01-18T14:35:22.000614
1,516,286,122.000614
29,628
pythondev
help
Ok I’m with you so far
2018-01-18T14:35:36.000652
Bella
pythondev_help_Bella_2018-01-18T14:35:36.000652
1,516,286,136.000652
29,629
pythondev
help
Lemme try to clarify my confusion with a two simple questions
2018-01-18T14:35:46.000236
Bella
pythondev_help_Bella_2018-01-18T14:35:46.000236
1,516,286,146.000236
29,630
pythondev
help
ok
2018-01-18T14:35:49.000092
Floy
pythondev_help_Floy_2018-01-18T14:35:49.000092
1,516,286,149.000092
29,631
pythondev
help
If done right, how many files should have to be updated when the DB’s schema changes? I presume 1?
2018-01-18T14:36:13.000307
Bella
pythondev_help_Bella_2018-01-18T14:36:13.000307
1,516,286,173.000307
29,632
pythondev
help
it depends on how you structure it
2018-01-18T14:36:44.000078
Floy
pythondev_help_Floy_2018-01-18T14:36:44.000078
1,516,286,204.000078
29,633
pythondev
help
could be one
2018-01-18T14:36:46.000569
Floy
pythondev_help_Floy_2018-01-18T14:36:46.000569
1,516,286,206.000569
29,634
pythondev
help
could be more
2018-01-18T14:37:50.000080
Floy
pythondev_help_Floy_2018-01-18T14:37:50.000080
1,516,286,270.00008
29,635
pythondev
help
the difficult part with this is speaking in such generalities
2018-01-18T14:38:02.000330
Floy
pythondev_help_Floy_2018-01-18T14:38:02.000330
1,516,286,282.00033
29,636
pythondev
help
Ok, lemme ask my second question and see if it sheds like on what our answer should be for my first one then
2018-01-18T14:38:22.000743
Bella
pythondev_help_Bella_2018-01-18T14:38:22.000743
1,516,286,302.000743
29,637
pythondev
help
I’m sure you’re aware that lots of answers start with ‘it depends’
2018-01-18T14:38:39.000510
Floy
pythondev_help_Floy_2018-01-18T14:38:39.000510
1,516,286,319.00051
29,638
pythondev
help
Oh yes ha
2018-01-18T14:38:46.000446
Bella
pythondev_help_Bella_2018-01-18T14:38:46.000446
1,516,286,326.000446
29,639
pythondev
help
because approaches to solutions are highly dependent on specifics
2018-01-18T14:39:15.000725
Floy
pythondev_help_Floy_2018-01-18T14:39:15.000725
1,516,286,355.000725
29,640
pythondev
help
what works for one way might not for another because of two or three specific differences
2018-01-18T14:39:34.000272
Floy
pythondev_help_Floy_2018-01-18T14:39:34.000272
1,516,286,374.000272
29,641
pythondev
help
Understood
2018-01-18T14:39:57.000209
Bella
pythondev_help_Bella_2018-01-18T14:39:57.000209
1,516,286,397.000209
29,642
pythondev
help
I have three files: `app.py` - defines my endpoints `SQLiteDataBaseAdapter.py` - responsible for CRUD operations on the data base `Rule.py` - my domain model I’m having a hard time envisioning *any* solution that allows my setup above to confine the DB schema knowledge to a single file. This is because the `SQLiteDa...
2018-01-18T14:42:11.000046
Bella
pythondev_help_Bella_2018-01-18T14:42:11.000046
1,516,286,531.000046
29,643
pythondev
help
sounds about right
2018-01-18T14:43:13.000377
Floy
pythondev_help_Floy_2018-01-18T14:43:13.000377
1,516,286,593.000377
29,644
pythondev
help
but `app.py` doesn’t need to know the db schema, at least not explicitly
2018-01-18T14:43:36.000676
Floy
pythondev_help_Floy_2018-01-18T14:43:36.000676
1,516,286,616.000676
29,645
pythondev
help
if you’re passing in things for your db adapter to execute, it has to know those fields
2018-01-18T14:43:55.000519
Floy
pythondev_help_Floy_2018-01-18T14:43:55.000519
1,516,286,635.000519
29,646
pythondev
help
Agreed.
2018-01-18T14:46:35.000200
Bella
pythondev_help_Bella_2018-01-18T14:46:35.000200
1,516,286,795.0002
29,647
pythondev
help
So I might not be in a horrible situation, having to update both my `SQLiteDataBaseAdapter.py` and `Rule.py` when the schema changes, correct?
2018-01-18T14:47:25.000603
Bella
pythondev_help_Bella_2018-01-18T14:47:25.000603
1,516,286,845.000603
29,648
pythondev
help
I mean, there’s going to be a point where any changes are going to be a pain in the ass keeping up with data schemas. that’s why most people like to use object-relational mappers like sqlalchemy to abstract that part away
2018-01-18T14:49:17.000174
Floy
pythondev_help_Floy_2018-01-18T14:49:17.000174
1,516,286,957.000174
29,649
pythondev
help
plus, it is very, very very easy for you as a SQL learner to write very bad queries
2018-01-18T14:49:41.000494
Floy
pythondev_help_Floy_2018-01-18T14:49:41.000494
1,516,286,981.000494
29,650
pythondev
help
Understood.
2018-01-18T14:49:57.000568
Bella
pythondev_help_Bella_2018-01-18T14:49:57.000568
1,516,286,997.000568
29,651
pythondev
help
One of the goals of this project is for me to learn SQL better, so defaulting to an ORM isn’t going to help me imo
2018-01-18T14:50:12.000843
Bella
pythondev_help_Bella_2018-01-18T14:50:12.000843
1,516,287,012.000843
29,652
pythondev
help
yep
2018-01-18T14:50:18.000085
Floy
pythondev_help_Floy_2018-01-18T14:50:18.000085
1,516,287,018.000085
29,653
pythondev
help
alright, thank you dd82, you’ve helped me quite a bit
2018-01-18T14:50:20.000755
Bella
pythondev_help_Bella_2018-01-18T14:50:20.000755
1,516,287,020.000755
29,654
pythondev
help
is there such thing as karma on this team? <@Floy>++
2018-01-18T14:50:37.000097
Bella
pythondev_help_Bella_2018-01-18T14:50:37.000097
1,516,287,037.000097
29,655
pythondev
help
that said, you don’t necessarily need to use python or all this
2018-01-18T14:50:40.000565
Floy
pythondev_help_Floy_2018-01-18T14:50:40.000565
1,516,287,040.000565
29,656
pythondev
help
you can just use a regular db and its interface to construct the queries and see where they go
2018-01-18T14:51:02.000179
Floy
pythondev_help_Floy_2018-01-18T14:51:02.000179
1,516,287,062.000179
29,657
pythondev
help
we use tacos, eg `@username :taco:`
2018-01-18T14:51:14.000303
Floy
pythondev_help_Floy_2018-01-18T14:51:14.000303
1,516,287,074.000303
29,658
pythondev
help
<@Bella> You can give someone a taco
2018-01-18T14:51:27.000603
Rigoberto
pythondev_help_Rigoberto_2018-01-18T14:51:27.000603
1,516,287,087.000603
29,659
pythondev
help
if you’re on osx, I like Sequel Pro
2018-01-18T14:52:13.000035
Floy
pythondev_help_Floy_2018-01-18T14:52:13.000035
1,516,287,133.000035
29,660
pythondev
help
<@Floy> :taco: I always forget that’s a thing here
2018-01-18T14:52:14.000485
Bella
pythondev_help_Bella_2018-01-18T14:52:14.000485
1,516,287,134.000485
29,661
pythondev
help
works with mysql and sqlite
2018-01-18T14:52:21.000078
Floy
pythondev_help_Floy_2018-01-18T14:52:21.000078
1,516,287,141.000078
29,662
pythondev
help
<@Floy> Can you talk to me what you mean by this: &gt; you can just use a regular db and its interface to construct the queries and see where they go I use both Sequel Pro and DB Browser for SQLite and not familiar with what you’re mentioning here
2018-01-18T14:52:59.000217
Bella
pythondev_help_Bella_2018-01-18T14:52:59.000217
1,516,287,179.000217
29,663
pythondev
help
ha, thanks!
2018-01-18T14:53:00.000350
Floy
pythondev_help_Floy_2018-01-18T14:53:00.000350
1,516,287,180.00035
29,664
pythondev
help
write your queries in there
2018-01-18T14:53:11.000204
Floy
pythondev_help_Floy_2018-01-18T14:53:11.000204
1,516,287,191.000204
29,665
pythondev
help
you can do your crud queries right there, without having to deal with actual python code
2018-01-18T14:53:23.001085
Floy
pythondev_help_Floy_2018-01-18T14:53:23.001085
1,516,287,203.001085
29,666
pythondev
help
and will probably get you more comfortable with SQL faster, since you don’t have to think in two languages
2018-01-18T14:53:47.000251
Floy
pythondev_help_Floy_2018-01-18T14:53:47.000251
1,516,287,227.000251
29,667
pythondev
help
<http://www.padjo.org/tutorials/databases/getting-around-sqlite-and-sequel-pro/>
2018-01-18T14:54:38.001166
Floy
pythondev_help_Floy_2018-01-18T14:54:38.001166
1,516,287,278.001166
29,668
pythondev
help
<@Floy> I’m not sure how this relates to my problem. I have an instance of my domain model, `Rule`, and need to write it to the DB. How would using anything like Sequel Pro, allow me to reference my `Rule` instance?
2018-01-18T15:34:30.000911
Bella
pythondev_help_Bella_2018-01-18T15:34:30.000911
1,516,289,670.000911
29,669
pythondev
help
your goal here is to learn SQL, right?
2018-01-18T15:40:24.000734
Floy
pythondev_help_Floy_2018-01-18T15:40:24.000734
1,516,290,024.000734
29,670
pythondev
help
Not the goal, my goal is to build a working API. One of things I set out to do was additionally become comfortable with basic SQL queries.
2018-01-18T15:41:12.000587
Bella
pythondev_help_Bella_2018-01-18T15:41:12.000587
1,516,290,072.000587
29,671
pythondev
help
That doesn’t really answer your question very well, i know :confused:
2018-01-18T15:41:21.000799
Bella
pythondev_help_Bella_2018-01-18T15:41:21.000799
1,516,290,081.000799
29,672
pythondev
help
I think I am realizing I can either use an ORM, or bite the bullet, and update more than one spot
2018-01-18T15:42:00.000509
Bella
pythondev_help_Bella_2018-01-18T15:42:00.000509
1,516,290,120.000509
29,673
pythondev
help
pretty much, yes
2018-01-18T15:42:08.001088
Floy
pythondev_help_Floy_2018-01-18T15:42:08.001088
1,516,290,128.001088
29,674
pythondev
help
and with sqlalchemy, you can print out the queries it generates
2018-01-18T15:42:21.000045
Floy
pythondev_help_Floy_2018-01-18T15:42:21.000045
1,516,290,141.000045
29,675
pythondev
help
personally, I would stay away from writing raw sql at this stage
2018-01-18T15:42:41.000187
Floy
pythondev_help_Floy_2018-01-18T15:42:41.000187
1,516,290,161.000187
29,676
pythondev
help
unless you’re doing it in the db shell or GUI application
2018-01-18T15:42:53.000528
Floy
pythondev_help_Floy_2018-01-18T15:42:53.000528
1,516,290,173.000528
29,677
pythondev
help
Understood, thank you again. I’ll have to make a call and just move on at this point
2018-01-18T15:54:16.000047
Bella
pythondev_help_Bella_2018-01-18T15:54:16.000047
1,516,290,856.000047
29,678
pythondev
help
I would probably separate the two things. If you want to practice SQL think up of some reports you might need from some data. The reason I say this is that in programming database layers used to be created almost on a per project basis. This doesn’t really bode well with the concept of DRY. We have SQLAlchemy ORM which...
2018-01-18T15:57:22.001232
Davina
pythondev_help_Davina_2018-01-18T15:57:22.001232
1,516,291,042.001232
29,679
pythondev
help
the other reason there is a frame of mind when you think of using SQL and programming within a language.
2018-01-18T15:58:00.000540
Davina
pythondev_help_Davina_2018-01-18T15:58:00.000540
1,516,291,080.00054
29,680
pythondev
help
when you start programming you’ll see you operate on the data with a cursor, or iterate on each row. When you work with mainly SQL you need to think about the data in a different way. You work with the data in sets. A SQL query essentially works on a lot of data (think of a lot of balls falling) and your where clause b...
2018-01-18T15:59:41.000691
Davina
pythondev_help_Davina_2018-01-18T15:59:41.000691
1,516,291,181.000691
29,681
pythondev
help
<@Davina> So, if I understood correctly, you’re pro ORM when the goal is to write an application?
2018-01-18T16:01:06.000607
Bella
pythondev_help_Bella_2018-01-18T16:01:06.000607
1,516,291,266.000607
29,682
pythondev
help
it depends.
2018-01-18T16:01:12.000712
Davina
pythondev_help_Davina_2018-01-18T16:01:12.000712
1,516,291,272.000712
29,683
pythondev
help
lol
2018-01-18T16:01:17.000001
Davina
pythondev_help_Davina_2018-01-18T16:01:17.000001
1,516,291,277.000001
29,684
pythondev
help
hahahaha
2018-01-18T16:01:26.000298
Bella
pythondev_help_Bella_2018-01-18T16:01:26.000298
1,516,291,286.000298
29,685
pythondev
help
my favorite sentence today
2018-01-18T16:01:31.000660
Bella
pythondev_help_Bella_2018-01-18T16:01:31.000660
1,516,291,291.00066
29,686
pythondev
help
SQLAlchemy is more than just an ORM tho.
2018-01-18T16:01:36.000625
Davina
pythondev_help_Davina_2018-01-18T16:01:36.000625
1,516,291,296.000625
29,687
pythondev
help
SQLAlchemy has what is known as the core which is a domain specific language for SQL that is based in python.
2018-01-18T16:02:03.000317
Davina
pythondev_help_Davina_2018-01-18T16:02:03.000317
1,516,291,323.000317
29,688
pythondev
help
the way it looks almost mimics a SQL query. `select([table]).where(table.c.column == 'foo')`
2018-01-18T16:02:41.000188
Davina
pythondev_help_Davina_2018-01-18T16:02:41.000188
1,516,291,361.000188
29,689
pythondev
help
which would be: ``` SELECT * FROM table WHERE table.column = 'foo' ```
2018-01-18T16:03:25.000361
Davina
pythondev_help_Davina_2018-01-18T16:03:25.000361
1,516,291,405.000361
29,690
pythondev
help
so why choose one over the other?
2018-01-18T16:04:04.000144
Davina
pythondev_help_Davina_2018-01-18T16:04:04.000144
1,516,291,444.000144
29,691
pythondev
help
Well, some applications don’t need to worry about the database schema so much. You may want to work more with business objects rather than be concerned with the structure of the db. If that is what you require than the ORM is great.
2018-01-18T16:04:50.000577
Davina
pythondev_help_Davina_2018-01-18T16:04:50.000577
1,516,291,490.000577
29,692
pythondev
help
It will essentially work like writing regular python. However, if you need to be more concerned with the schema or require a more performance the core may be better.
2018-01-18T16:05:20.000226
Davina
pythondev_help_Davina_2018-01-18T16:05:20.000226
1,516,291,520.000226
29,693
pythondev
help
There is some overhead when using an ORM but you gain more b/c it is more understandable and doesn’t require extensive SQL knowledge.
2018-01-18T16:06:28.000307
Davina
pythondev_help_Davina_2018-01-18T16:06:28.000307
1,516,291,588.000307
29,694
pythondev
help
Ok thanks <@Davina>, i appreciate the writeup and helping me decide what to do :tacobell:
2018-01-18T16:06:59.000166
Bella
pythondev_help_Bella_2018-01-18T16:06:59.000166
1,516,291,619.000166
29,695
pythondev
help
In other words, the ORM is a much higher abstraction.
2018-01-18T16:07:01.000525
Davina
pythondev_help_Davina_2018-01-18T16:07:01.000525
1,516,291,621.000525
29,696
pythondev
help
woops…
2018-01-18T16:07:02.000858
Bella
pythondev_help_Bella_2018-01-18T16:07:02.000858
1,516,291,622.000858
29,697
pythondev
help
<@Davina> :taco:
2018-01-18T16:07:09.000276
Bella
pythondev_help_Bella_2018-01-18T16:07:09.000276
1,516,291,629.000276
29,698
pythondev
help
i will note that learning SQL will not hurt. I learned SQL first before even knowing python. It has been an extremely valuable skill for me.
2018-01-18T16:09:23.000013
Davina
pythondev_help_Davina_2018-01-18T16:09:23.000013
1,516,291,763.000013
29,699
pythondev
help
my main point is to not try to mix the two too much. if you want to focus on SQL then focus on SQL. If you want to build an API focus on building the API. imo.
2018-01-18T16:10:21.000334
Davina
pythondev_help_Davina_2018-01-18T16:10:21.000334
1,516,291,821.000334
29,700
pythondev
help
<@Davina> so in case of focusing on sql, you would advise e.g. `psycopg2` in case of using a postgres db?
2018-01-18T16:14:06.000385
Stefan
pythondev_help_Stefan_2018-01-18T16:14:06.000385
1,516,292,046.000385
29,701
pythondev
help
yea, you can also run SQL through sqlalchemy too.
2018-01-18T16:14:44.000553
Davina
pythondev_help_Davina_2018-01-18T16:14:44.000553
1,516,292,084.000553
29,702
pythondev
help
but if you don’t need any of the other features of sqlalchemy psycopg2 should be fine.
2018-01-18T16:15:06.000956
Davina
pythondev_help_Davina_2018-01-18T16:15:06.000956
1,516,292,106.000956
29,703
pythondev
help
though in that case maybe a mix would be best
2018-01-18T16:16:23.000081
Stefan
pythondev_help_Stefan_2018-01-18T16:16:23.000081
1,516,292,183.000081
29,704
pythondev
help
I have a DB phobia, difficult to get over it
2018-01-18T16:16:51.000473
Stefan
pythondev_help_Stefan_2018-01-18T16:16:51.000473
1,516,292,211.000473
29,705
pythondev
help
today I heard a story of a colleague who had to split a single table for multiple enterprise customers &amp; systems, and it took 4 sprints to get it done :confused:
2018-01-18T16:17:40.000819
Stefan
pythondev_help_Stefan_2018-01-18T16:17:40.000819
1,516,292,260.000819
29,706
pythondev
help
I would watch the beginning of this video: <http://pyvideo.org/pycon-us-2010/pycon-2010--introduction-to-sqlalchemy.html>
2018-01-18T16:18:05.001054
Davina
pythondev_help_Davina_2018-01-18T16:18:05.001054
1,516,292,285.001054
29,707
pythondev
help
it highlights the difficulties of using pure SQL.
2018-01-18T16:18:25.000556
Davina
pythondev_help_Davina_2018-01-18T16:18:25.000556
1,516,292,305.000556
29,708
pythondev
help
cool thanks. I saw one from Brandon Rhodes, very awesome. He's one of my favorites
2018-01-18T16:18:32.000323
Stefan
pythondev_help_Stefan_2018-01-18T16:18:32.000323
1,516,292,312.000323
29,709
pythondev
help
and why using something like sqlalchemy makes life easier for python programmers.
2018-01-18T16:18:44.000404
Davina
pythondev_help_Davina_2018-01-18T16:18:44.000404
1,516,292,324.000404
29,710
pythondev
help
do you think a startup should go for the ORM solution?
2018-01-18T16:19:51.000583
Stefan
pythondev_help_Stefan_2018-01-18T16:19:51.000583
1,516,292,391.000583
29,711
pythondev
help
if a company wants to sell data, still xD?
2018-01-18T16:20:03.000649
Stefan
pythondev_help_Stefan_2018-01-18T16:20:03.000649
1,516,292,403.000649
29,712
pythondev
help
again, it depends.
2018-01-18T16:20:21.000023
Davina
pythondev_help_Davina_2018-01-18T16:20:21.000023
1,516,292,421.000023
29,713
pythondev
help
for relational data, yes. Pick one that allows you to easily drop into SQL when necessary
2018-01-18T16:20:46.000542
Floy
pythondev_help_Floy_2018-01-18T16:20:46.000542
1,516,292,446.000542
29,714
pythondev
help
the ORM will allow you not have to deal with a lot of details… but it is generating SQL for you.
2018-01-18T16:20:48.000571
Davina
pythondev_help_Davina_2018-01-18T16:20:48.000571
1,516,292,448.000571
29,715
pythondev
help
but for nosql dbs, probably not
2018-01-18T16:21:04.000947
Floy
pythondev_help_Floy_2018-01-18T16:21:04.000947
1,516,292,464.000947
29,716
pythondev
help
SQLAlchemy is better than most. it’s quite surprising actually.
2018-01-18T16:21:16.000576
Davina
pythondev_help_Davina_2018-01-18T16:21:16.000576
1,516,292,476.000576
29,717
pythondev
help
I feel like nosql is just convenient on day 1, but as soon as you reach day 30 you will have to get relational / structured lol
2018-01-18T16:21:32.001215
Stefan
pythondev_help_Stefan_2018-01-18T16:21:32.001215
1,516,292,492.001215
29,718
pythondev
help
its nice to dump stuff in at day 1, but you'll pay the price later, when you have to write queries
2018-01-18T16:21:51.000030
Stefan
pythondev_help_Stefan_2018-01-18T16:21:51.000030
1,516,292,511.00003
29,719
pythondev
help
haha, i stick to relational b/c if you want some of those features of nosql postgres has the ability to use jsonb
2018-01-18T16:22:00.000302
Davina
pythondev_help_Davina_2018-01-18T16:22:00.000302
1,516,292,520.000302
29,720
pythondev
help
that’s primarily a lack of requirements gathering, I feel
2018-01-18T16:22:08.000572
Floy
pythondev_help_Floy_2018-01-18T16:22:08.000572
1,516,292,528.000572
29,721
pythondev
help
<@Floy> touche lol
2018-01-18T16:22:17.000399
Stefan
pythondev_help_Stefan_2018-01-18T16:22:17.000399
1,516,292,537.000399
29,722
pythondev
help
i’ve used it plenty of times and it’s great when you use it correctly.
2018-01-18T16:22:17.000805
Davina
pythondev_help_Davina_2018-01-18T16:22:17.000805
1,516,292,537.000805
29,723