inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

이야기를 나눠요

173만명의 커뮤니티!! 함께 토론해봐요.

버전을 맞추었는데도 오류가 발생합니다. (pd ver: 2.0.3, sqlalchemy: 2.0.0)

다양한 사례로 익히는 SQL 데이터 분석

query = """ select * from nw.customers """ df = pd.read_sql_query(sql=query, con=postgres_engine) df.head(10) --------------------------------------------------------------------------- UnicodeDecodeError Traceback (most recent call last) Cell In[25], line 4 1 query = """ 2 select * from nw.customers 3 """ ----> 4 df = pd.read_sql_query(sql=query, con=postgres_engine) 5 df.head(10) File ~\anaconda3\Lib\site-packages\pandas\io\sql.py:468, in read_sql_query(sql, con, index_col, coerce_float, params, parse_dates, chunksize, dtype, dtype_backend) 465 if dtype_backend is lib.no_default: 466 dtype_backend = "numpy" # type: ignore[assignment] --> 468 with pandasSQL_builder(con) as pandas_sql: 469 return pandas_sql.read_query( 470 sql, 471 index_col=index_col, (...) 477 dtype_backend=dtype_backend, 478 ) File ~\anaconda3\Lib\site-packages\pandas\io\sql.py:832, in pandasSQL_builder(con, schema, need_transaction) 829 raise ImportError("Using URI string without sqlalchemy installed.") 831 if sqlalchemy is not None and isinstance(con, (str, sqlalchemy.engine.Connectable)): --> 832 return SQLDatabase(con, schema, need_transaction) 834 warnings.warn( 835 "pandas only supports SQLAlchemy connectable (engine/connection) or " 836 "database string URI or sqlite3 DBAPI2 connection. Other DBAPI2 " (...) 839 stacklevel=find_stack_level(), 840 ) 841 return SQLiteDatabase(con) File ~\anaconda3\Lib\site-packages\pandas\io\sql.py:1539, in SQLDatabase.__init__(self, con, schema, need_transaction) 1537 self.exit_stack.callback(con.dispose) 1538 if isinstance(con, Engine): -> 1539 con = self.exit_stack.enter_context(con.connect()) 1540 if need_transaction and not con.in_transaction(): 1541 self.exit_stack.enter_context(con.begin()) File ~\anaconda3\Lib\site-packages\sqlalchemy\engine\base.py:3245, in Engine.connect(self) 3222 def connect(self) -> Connection: 3223 """Return a new :class:`_engine.Connection` object. 3224 3225 The :class:`_engine.Connection` acts as a Python context manager, so (...) 3242 3243 """ -> 3245 return self._connection_cls(self) File ~\anaconda3\Lib\site-packages\sqlalchemy\engine\base.py:145, in Connection.__init__(self, engine, connection, _has_events, _allow_revalidate, _allow_autobegin) 143 if connection is None: 144 try: --> 145 self._dbapi_connection = engine.raw_connection() 146 except dialect.loaded_dbapi.Error as err: 147 Connection._handle_dbapi_exception_noconnection( 148 err, dialect, engine 149 ) File ~\anaconda3\Lib\site-packages\sqlalchemy\engine\base.py:3269, in Engine.raw_connection(self) 3247 def raw_connection(self) -> PoolProxiedConnection: 3248 """Return a "raw" DBAPI connection from the connection pool. 3249 3250 The returned object is a proxied version of the DBAPI (...) 3267 3268 """ -> 3269 return self.pool.connect() File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:452, in Pool.connect(self) 444 def connect(self) -> PoolProxiedConnection: 445 """Return a DBAPI connection from the pool. 446 447 The connection is instrumented such that when its (...) 450 451 """ --> 452 return _ConnectionFairy._checkout(self) File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:1255, in _ConnectionFairy._checkout(cls, pool, threadconns, fairy) 1247 @classmethod 1248 def _checkout( 1249 cls, (...) 1252 fairy: Optional[_ConnectionFairy] = None, 1253 ) -> _ConnectionFairy: 1254 if not fairy: -> 1255 fairy = _ConnectionRecord.checkout(pool) 1257 if threadconns is not None: 1258 threadconns.current = weakref.ref(fairy) File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:716, in _ConnectionRecord.checkout(cls, pool) 714 rec = cast(_ConnectionRecord, pool._do_get()) 715 else: --> 716 rec = pool._do_get() 718 try: 719 dbapi_connection = rec.get_connection() File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\impl.py:168, in QueuePool._do_get(self) 166 return self._create_connection() 167 except: --> 168 with util.safe_reraise(): 169 self._dec_overflow() 170 raise File ~\anaconda3\Lib\site-packages\sqlalchemy\util\langhelpers.py:147, in safe_reraise.__exit__(self, type_, value, traceback) 145 assert exc_value is not None 146 self._exc_info = None # remove potential circular references --> 147 raise exc_value.with_traceback(exc_tb) 148 else: 149 self._exc_info = None # remove potential circular references File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\impl.py:166, in QueuePool._do_get(self) 164 if self._inc_overflow(): 165 try: --> 166 return self._create_connection() 167 except: 168 with util.safe_reraise(): File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:393, in Pool._create_connection(self) 390 def _create_connection(self) -> ConnectionPoolEntry: 391 """Called by subclasses to create a new ConnectionRecord.""" --> 393 return _ConnectionRecord(self) File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:678, in _ConnectionRecord.__init__(self, pool, connect) 676 self.__pool = pool 677 if connect: --> 678 self.__connect() 679 self.finalize_callback = deque() File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:902, in _ConnectionRecord.__connect(self) 900 self.fresh = True 901 except BaseException as e: --> 902 with util.safe_reraise(): 903 pool.logger.debug("Error on connect(): %s", e) 904 else: 905 # in SQLAlchemy 1.4 the first_connect event is not used by 906 # the engine, so this will usually not be set File ~\anaconda3\Lib\site-packages\sqlalchemy\util\langhelpers.py:147, in safe_reraise.__exit__(self, type_, value, traceback) 145 assert exc_value is not None 146 self._exc_info = None # remove potential circular references --> 147 raise exc_value.with_traceback(exc_tb) 148 else: 149 self._exc_info = None # remove potential circular references File ~\anaconda3\Lib\site-packages\sqlalchemy\pool\base.py:898, in _ConnectionRecord.__connect(self) 896 try: 897 self.starttime = time.time() --> 898 self.dbapi_connection = connection = pool._invoke_creator(self) 899 pool.logger.debug("Created new connection %r", connection) 900 self.fresh = True File ~\anaconda3\Lib\site-packages\sqlalchemy\engine\create.py:640, in create_engine.<locals>.connect(connection_record) 638 if connection is not None: 639 return connection --> 640 return dialect.connect(*cargs, **cparams) File ~\anaconda3\Lib\site-packages\sqlalchemy\engine\default.py:580, in DefaultDialect.connect(self, *cargs, **cparams) 578 def connect(self, *cargs, **cparams): 579 # inherits the docstring from interfaces.Dialect.connect --> 580 return self.loaded_dbapi.connect(*cargs, **cparams) File ~\anaconda3\Lib\site-packages\psycopg2\__init__.py:122, in connect(dsn, connection_factory, cursor_factory, **kwargs) 119 kwasync['async_'] = kwargs.pop('async_') 121 dsn = _ext.make_dsn(dsn, **kwargs) --> 122 conn = _connect(dsn, connection_factory=connection_factory, **kwasync) 123 if cursor_factory is not None: 124 conn.cursor_factory = cursor_factory UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb8 in position 63: invalid start byte 판다스 버전과 sqlalchemy 버전은 다음과 같이 맞추었습니다 2.0.3 2.0.0

  • sql
  • postgresql
  • dbms/rdbms
  • 퍼포먼스-마케팅
  • 데이터-엔지니어링
KoKuMa 댓글 1 좋아요 0 조회수 2343

선생님 안녕하세요!

Oracle PL/SQL 딱 이만큼.. [개념+실전]

안녕하세요! 수업 정말 잘듣고 있습니다!! 공부한거를 블로그에 작성 하려하는데 예제 같은 것을 출처를 밝혀 포스팅 해도될까요??

  • sql
  • oracle
  • PL/SQL
고재형 댓글 1 좋아요 0 조회수 504

Spring Cloud Config 사용시 의존 문제

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

강의 잘 듣고 있습니다. msa를 현업에서 적용시키려고 하고있는데 질문이있습니다. Spring Cloud Config 가 가지고 있는 경로에 Database 연결 정보를 넣고 db를 사용하는 Micro service들이 해당 config서비스를 빌드시 참조하도록 설계해보았는데요, Spring Cloud Config service에 너무 의존을 하고 있는거 같단 생각이 듭니다. 해당 서비스가 먹통이되면 다른 서비스 모두 db는 사용할 수 없다는 치명적인 이슈가 있으니까요. 현업에서 Spring Cloud Config 서비스를 구현할 때에 이렇게 크리티컬한 정보는 사용하지 않는지, 사용한다면 어떻게 의존성이 강한 문제를 해결 할 수 있는지 궁금합니다.

  • spring-boot
  • jpa
  • 아키텍처
  • spring-cloud
  • kafka
  • msa
  • rabbitmq
성현 댓글 0 좋아요 0 조회수 637

서킷 브레이커 상태 OPEN 전환의 기준 질문드립니다!

장애 없는 서비스를 만들기 위한 Resilience4j - CircuitBreaker

안녕하세요! 좋은 강의 제공해주셔서 도움이 많이 됐습니다! 수강 후 서킷 브레이커를 프로젝트에 적용해보는 과정에서 궁금한 점이 있어 질문드립니다. 현재 캐시 서버에 서킷 브레이커를 도입해서 장애 발생 시 DB로 우회하도록 구현 했습니다. 여기서 만약 레디스 클러스터를 구축한다면 Master 노드 다운 시 Replica가 새로운 마스터로 승격되면서 Failover가 일어날텐데요! 이때 1. Master와 Replica가 서로 health check를 하는 시간의 timeout 2. 승격이 일어나는 시간 3. Redis Cluster의 Topology를 refresh 하는 주기(현재 Redis Client로 Lettuce를 사용중입니다!) 이 시간 동안은 Redis로 정상 요청이 되지 않을 것입니다. 저는 개인적으로 레디스가 자동으로 Failover 되는 과정은 스스로 회복하는 시간이기에 서킷이 OPEN되야하는 상황으로 보기 힘들다 생각하는데, 서킷의 슬라이딩 윈도우를 설정할때 Failover 동안은 OPEN이 열리지 않을 정도로 여유롭게 설정하는게 좋을까요? 물론 구체적인 값은 트래픽을 예상해서 설정해야 한다고 생각합니다! 결론은, 클러스터의 Failover도 장애로 감지하고 OPEN으로 여는게 좋을지 아니면 Failover는 CLOSE 상태로 넘어갈 수 있도록 여유롭게 설정하는게 좋을지 입니다! 아직 실무 경험이 없기도 하고 주변에 의견을 구할수가 없어서 현업자의 입장에서 강사님이라면 어떻게 구성하실지 궁금해서 여쭤봅니다...!! 혼자 고민해본 부분이다 보니 제가 생각하는 방식이 틀렸다면 피드백 주시면 감사합니다:)

  • spring-boot
  • msa
  • circuit-breaker
  • resilience4j
jmin 댓글 2 좋아요 1 조회수 613

빠르게 코딩하기 위한 단축기 문의 (팁)

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

삭제된 글입니다

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
hello4298 댓글 1 좋아요 0 조회수 444

선생님 혹시 tableau 강의는 없을까요

[백문이불여일타] 데이터 분석을 위한 중급 SQL 문제풀이

SAS만 다뤘었고 SQL + Python이 대세인 가 싶었는데 어느 순간 대시보드 구축능력도 요구하네요 ㅋㅋㅋㅋ tableau 강의가 있으실지요.. 뭐부터 손을 대야 할지 .. 고민입니다.

  • sql
러시안블루 댓글 0 좋아요 0 조회수 504

sql 이후 머신러닝을 배우려 합니다.

데이터 분석 SQL Fundamentals

이왕이면 강사님께서 올리신 강좌를 구매해 이어서 학습을 해보려 합니다. 로드맵이 있다면, 보고 구매를 하려고 했는데 올려져 있는 강의 수는 많은데 머신러닝 관련 로드맵이 없더라고요 파이썬 머신러닝 완벽 가이드, 딥러닝 컴퓨터 비전 완벽 가이드 딥러닝 CNN 완벽 가이드 캐글 advanced 머신러닝 실전 박치기 이 강의들을 기본부터 학습하려 하는데요 오래된 강좌가 개정되어 다른 이름으로 만들어져 있어서 내용이 겹치는게 있는지 아니면 모두 수강하는게 맞는지 어떤 순서로 학습하면 되는지 알고 싶습니다.

  • sql
  • postgresql
  • dbms/rdbms
bluebamus 댓글 1 좋아요 0 조회수 686

안녕하세요 선생님 SQLD 자격증을 취득하기위해선 해당 강의 로드맵을 다 듣는게 좋을까요?

[백문이불여일타] 데이터 분석을 위한 중급 SQL 문제풀이

안녕하세요. 강의를 보면서 열심히 공부하고있습니다. 다름이 아니라 이번에 SQLD 자격증 시험을 신청했습니다. 해당 강의 로드맵을 다 듣고 노랭이 책을 풀려고하는데, 해당 강의 로드맵을 전체적으로 들으면 될까요?

  • sql
Glitch 댓글 0 좋아요 0 조회수 422

With 문

데이터 분석 SQL Fundamentals

강사님 안녕하세요, 조인실습2에서 부서명 SALES와 RESEARCH 소속 직원별로 과거부터 현재까지 모든 급여를 취합한 평균 급여 예시가 조금 헷갈립니다. With 문이 서브쿼리 역할을 하는걸로 이해하고 있는데 해당 예시에서 왜 with문이 왜 필요한지, with문 또는 서브쿼리 사용하지 않고 쿼리를 진행시키는 방법이 있는지 궁금합니다ㅠ

  • sql
  • postgresql
  • dbms/rdbms
Taylor Shin 댓글 2 좋아요 0 조회수 575

나래비는 일본어 입니다..

다양한 사례로 익히는 SQL 데이터 분석

선생님.. 나래비는 일본어 입니다. 어감이 예뻐서 옛 우리말인줄 알고 찾아봤는데 '줄을 세우다'라는 일본어 '나라비'가 어원이라고 하네요

  • sql
  • postgresql
  • dbms/rdbms
  • 퍼포먼스-마케팅
  • 데이터-엔지니어링
moonjeongro 댓글 1 좋아요 0 조회수 2160

문의 사항이 몇가지 있습니다.

오라클 성능 분석과 인스턴스 튜닝 핵심 가이드

안녕하세요 선생님. 문의드리고 싶은 내용이 있는데 글을 올릴 곳이 마땅치 않아 여기에 문의드립니다. 저는 현재 DBA 로 근무 중인데 SQL 작성 능력을 키우고 싶은데 혹시 선생님의 '데이터 분석 SQL Fundamentals' 강의가 DBA 업무 쿼리 작성에 도움이 될 수 있는 강의일까요? 일을 해보니 join, grouping 이 쉬운것 같으면서도 다양한 쿼리 작성 시에 자유자재로 안써지는 편이라 아직 공부가 덜 된것 같아서요. 일/주/월 사이즈 구하는 쿼리나 기타 여러 조건이 결합된 오브젝트 조회 쿼리를 주로 작성할 필요가 있고, 앞으로 튜닝 업무를 위한 튜닝 공부를 할 때도 기본 이상의 SQL 작성 능력이 필요하다고 판단되서 문의드립니다. 그리고 선생님의 ORACLE 아키텍쳐 강의는 출퇴근 간에 잘 듣고 있는데 혹시 SQL 튜닝 강의는 하실 예정이 있으실까요? 감사합니다.

  • oracle
  • sql
radh jigsawfit 댓글 1 좋아요 0 조회수 482

datagrip에서 복구하기

데이터 분석 SQL Fundamentals

datagrip에서 복구 하려고 하면 postgre 관련 cli 가 필요합니다. 아래와 같이 우선 실행 $ brew install libpq $ echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc $ source ~/.zshrc $ psql --version psql (PostgreSQL) 15.2 Path to pg_restore 에서 CMD+SHIFT+G 눌러서 brew로 설치한 디렉토리로 이동 이후 복구 하면 됩니다

  • sql
  • postgresql
  • dbms/rdbms
무리브 댓글 1 좋아요 2 조회수 2329

MacOS에서 MySQL workbench에서 조회할 때 튕기시는 분

갖고노는 MySQL 데이터베이스 by 얄코

sakila db 조회할 때마다 위처럼 튕겨서 찾아보니 MySQL workbench를 8.0.31버전으로 받아야한다고 하네요( 참고 ) 다운로드 링크: https://downloads.mysql.com/archives/workbench/

  • sql
  • mysql
  • dbms/rdbms
  • 데이터-엔지니어링
gyuray 댓글 0 좋아요 0 조회수 4255

spring-boot 2.7 이상을 사용 하시는 분의 경우

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

안녕하세요. 강사님께서는 2.6 버전을 사용 권장 하셨지만 왠지 모를 궁금함에 2.7에서 사용하는 spring security 5.7 이상에서 바뀐 부분으로 한번 적용을 해보고 싶었습니다. 인프런에 올라온 많은 분들의 질문을 정리 하여 만들어 보았습니다. package com.example.userservice.security; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import com.example.userservice.service.UserService; import lombok.RequiredArgsConstructor; @Configuration @EnableWebSecurity @RequiredArgsConstructor public class WebSecurity { private final UserService userService; private final BCryptPasswordEncoder bCryptPasswordEncoder; private final Environment env; AuthenticationManager authenticationManager; // spring.boot 2.7 부터는 WebSecurityConfigurerAdapter가 아닌 // SecurityFilterChain 을 사용 합니다. @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { AuthenticationManagerBuilder authenticationManagerBuilder = http.getSharedObject(AuthenticationManagerBuilder.class); authenticationManagerBuilder.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder); authenticationManager = authenticationManagerBuilder.build(); //AuthenticationFilter authenticationFilter = new AuthenticationFilter(); //authenticationFilter.setAuthenticationManager(authenticationManager); AuthenticationFilter authenticationFilter = new AuthenticationFilter(authenticationManager , userService , env); http.csrf().disable(); http.authorizeRequests() //.antMatchers("/error/**").permitAll() // public abstract java.lang.String javax.servlet.ServletRequest.getRemoteAddr() is not supported 보기 싫을때 활성화 .antMatchers("/**") .hasIpAddress("127.0.0.1") .and() .authenticationManager(authenticationManager) .addFilter(authenticationFilter) ; http.headers().frameOptions().disable(); return http.build(); } //ex) 기존의 경우 AuthenticationManagerBuilder 를 오버라이드 하여 사용 하였지만 filterChain 안에서 호출 하여 설정 합니다. /* protected void configure(AuthenticationManagerBuilder auth) throws Exception{ auth.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder); } */ //ex)filter를 authenticationAmanger에 주입 하던 getAuthenticationFilter역시 filterChain 내부에서 사용 합니다. /* private AuthenticationFilter getAuthenticationFilter() throws Exception { AuthenticationFilter authenticationFilter = new AuthenticationFilter(); authenticationFilter.setAuthenticationManager(authenticationManager); return authenticationFilter; } */ }

  • spring-boot
  • jpa
  • 아키텍처
  • spring-cloud
  • kafka
  • msa
최재영 댓글 0 좋아요 1 조회수 2544

정말 꿀팁 강의입니다...

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트

본 강의에서 알려주신 판다스 및 이미지 활용 예제를 알려주셔서 감사합니다. 강의 후반에 알려주신 것 처럼 활용 할 수 있는 부분이 굉장히 많아 보입니다. 판다스 예제를 views.py에 녹여 봤는데, 잘 출력됩니다 ㅎㅎ 이후 템플릿 폴더 내부 html 파일을 생성해서 디자인 좀 추가해 출력하면 분석 툴 제작도 충분히 가능할 듯 싶네요. 강의 중반까지 듣고 시도해 보겠습니다 :)

  • pandas
  • images
이재화 댓글 1 좋아요 3 조회수 325

MSA 와 관련하여 질문드립니다.

스프링 MVC 2편 - 백엔드 웹 개발 활용 기술

안녕하세요 완강 후 추가적으로 궁금한 사항이 있어서 글을 올리게 되었습니다. 요즘 대세인 MSA와 관련하여 여쭙고 싶어서 연락드립니다. [문제상황] MSA와 관련하여 아키텍쳐에서는 요청에 맞추어 반응하는 서버를 만들기 위하여 docker container 를 활용한 서버들을 많이 구성하는 걸로 알고 있습니다. 이때, Spring boot은 다양한 기능들을 제공하지만 python의 flask나 Fastapi와 같은 가벼운 프레임워크에 비해서는 안좋은 점들이 있을것이라 생각듭니다. (예를 들어서 컨테이너의 용량이 크고, 콜드 스타트의 시작이 늦다는 점... 이 대표적으로 생각납니다.) [질의사항] 1. Springboot 로 MSA를 구성하였을 경우 앞서 얘기드렸던 문제점이 없는지 여부 2. Springboot 가 MSA에서 갖는 장점 3. 프레임워크의 무겁다와 가볍다의 개념이 무엇인지 궁금합니다. 4. 배민에서는 JAVA를 사용하여 프로젝트를 진행하는데, 우리나라의 경우 JAVA를 사용하는 시니어개발자들이 많아 사용하는 걸로 알고있습니다. 만약 그렇지 않았다면, JAVA Spring boot 가 아닌 다른 프레임워클 사용하여 개발하였을지 궁금합니다. 감사합니다.

  • spring
  • msa
정영호 댓글 1 좋아요 0 조회수 614

인기 태그

인프런 TOP Writers

주간 인기글